Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-17-2008, 08:14 PM   #26 (permalink)
Registered Member
 
Join Date: Aug 2008
Posts: 146
Default

Disregard my last post. My issue was just that I was not including the CoreGraphics framework. It's working great now. Thanks!
svguerin3 is offline   Reply With Quote
Old 08-17-2008, 09:45 PM   #27 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 8
Default

hey!

i am new in iphone coding and very frustrated. I can't figure out how to manage a tab bar controller including a navigation controller including a tableviewcontroller. Would it be possible, if someone figured it out, to write down the source here or better to pm me a xcode project!

2 or more tabs
in one tab the nav controller and the tabelviewcontroller

thx

PS.: Sorry for my english i am not a native speaker!
macstar is offline   Reply With Quote
Old 08-17-2008, 09:48 PM   #28 (permalink)
Registered Member
 
Join Date: Aug 2008
Posts: 175
Default

Hey Dev,

This is probably simple, but whats the syntax to change the nav bar color to black or trans? Ive tried a few things, but nothing seems to work. Do you know? Thanks.

EDIT: It was simple....got it to work finally....

tableNavController.navigationBar.barStyle = UIBarStyleBlackOpaque;

Last edited by RockStrongo; 08-17-2008 at 10:13 PM.
RockStrongo is offline   Reply With Quote
Old 08-18-2008, 01:04 AM   #29 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 361
Default

Quote:
Originally Posted by macstar View Post
hey!

i am new in iphone coding and very frustrated. I can't figure out how to manage a tab bar controller including a navigation controller including a tableviewcontroller. Would it be possible, if someone figured it out, to write down the source here or better to pm me a xcode project!

2 or more tabs
in one tab the nav controller and the tabelviewcontroller

thx

PS.: Sorry for my english i am not a native speaker!

Hey macstar.

The source-code in this thread should help you with setting this up and running.

All you need to do is create a tableViewController, and add that on as one of your viewControllers. (a tableViewController is a subclass of a viewController, so it will do everything the same if you want it to)

so you need any more help than that
?

if you need further help, I can write some code up on here, but this app is your own. I'm not going to write your app for you. So I'll give major pointers, but its you that needs to learn the basics of how to tie things together.
DevTeamOfOne is offline   Reply With Quote
Old 08-18-2008, 09:49 AM   #30 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 8
Default

hey dev,

i would be very grateful if you can write some code down. I know i have to learn it by my self and i tried it, but examination of working code will help me at the moment a lot.

macstar
macstar is offline   Reply With Quote
Old 08-18-2008, 11:13 AM   #31 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 361
Default

Hey, look at my original post of code. I have already fixed it up and added some extra bits to help you out.

Look at the // bits for my comments to briefly explain what's going on.

My Original Post
DevTeamOfOne is offline   Reply With Quote
Old 08-18-2008, 01:59 PM   #32 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 8
Default

thx dev,

it works like a charm. i've tried it so much times with the interface builder before with no luck. It is so much easier in simple code.

macstar
macstar is offline   Reply With Quote
Old 08-18-2008, 02:14 PM   #33 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 361
Default

Told you
DevTeamOfOne is offline   Reply With Quote
Old 08-18-2008, 06:29 PM   #34 (permalink)
Registered Member
 
Join Date: Aug 2008
Posts: 175
Default

Quote:
Originally Posted by macstar View Post
hey dev,

i would be very grateful if you can write some code down. I know i have to learn it by my self and i tried it, but examination of working code will help me at the moment a lot.

macstar
Me and my friend are new to this too.....the sample code has really helped us out. Dev has definately pointed us in the right direction on some things and its been a big help, but sample code, guides and tutorials are really the way to start out to learn on your own.
RockStrongo is offline   Reply With Quote
Old 08-18-2008, 06:51 PM   #35 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 361
Default

Yes, Dev has been a very helpful non-existent smilie-face and now we should all pay homage. GROUP HUG!
DevTeamOfOne is offline   Reply With Quote
Old 08-19-2008, 11:39 PM   #36 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: Chile
Age: 31
Posts: 28
Default Great thread

Quote:
Originally Posted by DevTeamOfOne View Post
Yes, Dev has been a very helpful non-existent smilie-face and now we should all pay homage. GROUP HUG!
A huge hug for you

As the post title says, great thread DevTeamOfOne, it has been of great help for me... thanks to it I've been able to do in a couple of days more than I acheived struggling with IB over the lasts weeks.

Following your model I've been able to create my tabBar/NavBarController/tableView interface programatically and it's super-easy.

I'd like to ask you for a little guidance which I'm sure will help others as well.

I don't know if this is the right way of doing things but here it goes:

I'm creating a class from UIViewController for each of my table views inside the navigation controllers. As I said, I'm creating everything programatically instead of using IB as it seems easier (everything except the window which I haven't managed to get right, only a black window appears).

By now, I'm using the "-(id)initWithNibNameNSString *)nibNameOrNil bundleNSBundle *)nibBundleOrNil" method on my class just to set its title (self.title = @"My Title" so it shows in the NavBar from the beggining instead that after the view is loaded; also, on the loadView method I'm creating an UITableView and assigning it as the view for my Class. Finally, on the dealloc method of my class I'm releasing its tableView.

I'm implementing the UITableViewDataSource and UITableViewDelegate protocols so I also defined the numberOfRowsInSection and methods; by now, I just want to display static data.

What I described before I'm doing it the following way:

Code:
- (void)loadView {
	UITableView *tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain];
	tableView.autoresizingMask = (UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight);
	tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
	tableView.delegate = self;
	self.myTableView = tableView;
	self.view = tableView;
	[tableView release];
}

- (NSInteger)tableView:(UITableView *)myTableView numberOfRowsInSection:(NSInteger)section {
	// just a static number by now
	return 2;
}

- (UITableViewCell *)tableView:(UITableView *)myTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [self.myTableView dequeueReusableCellWithIdentifier:@"myCell"];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"myCell"] autorelease];
    }
	cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
	cell.text = [[NSString alloc] initWithFormat:@"Cell : %i", indexPath.row];
    return cell;
}
However... my table is just showing blank, I don't know really what I'm missing so any help to get this table to show (by now) just a couple of cells with static data would be greatly appreciated.

Best regards.
boliva is offline   Reply With Quote
Old 08-20-2008, 01:37 PM   #37 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 361
Default

Can you send me your project in a zip file and i will be able to help Table views, nav controllers, and tab bar controllers are my speciality
DevTeamOfOne is offline   Reply With Quote
Old 08-20-2008, 07:48 PM   #38 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: Chile
Age: 31
Posts: 28
Default

Quote:
Originally Posted by DevTeamOfOne View Post
Can you send me your project in a zip file and i will be able to help Table views, nav controllers, and tab bar controllers are my speciality
Sure, thanks for your time, patience and disposition.

Any guides on this will be greatly appreciated.

Best regards.
Attached Files
File Type: zip myApp.zip (17.0 KB, 641 views)
boliva is offline   Reply With Quote
Old 08-21-2008, 06:30 AM   #39 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: Montreal
Posts: 12
Default

I was just looking back at this code (which has been INDISPENSABLE to me), and a question popped into my head: why don't you release the UITabBarController? no autorelease? no release in the dealloc method? I'm confused.
samson514 is offline   Reply With Quote
Old 08-21-2008, 12:43 PM   #40 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 361
Default

no release seems to work on a tab bar controller, thats all.

Last edited by DevTeamOfOne; 08-21-2008 at 01:18 PM.
DevTeamOfOne is offline   Reply With Quote
Old 08-21-2008, 12:58 PM   #41 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 361
Default

Ok found my way around it. I have updated the sample code on page 1.
DevTeamOfOne is offline   Reply With Quote
Old 08-21-2008, 01:27 PM   #42 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 361
Default

Quote:
Originally Posted by boliva View Post
Sure, thanks for your time, patience and disposition.

Any guides on this will be greatly appreciated.

Best regards.

OK...

Two issues:

1. there is no declaration of "tableView.dataSource = self;"

and

2. there is no declaration to the amount of sections in the table.

add in myViewController the declaration:

- (NSInteger)numberOfSectionsInTableViewUITableVie w *)tableView {
return 1;
}
DevTeamOfOne is offline   Reply With Quote
Old 08-21-2008, 03:56 PM   #43 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: Chile
Age: 31
Posts: 28
Default

Wow, thanks for your answer. I knew I was missing my tableView dataSource declaration, which I didn't know that could be declared as 'self'. Now I'm all set to go.

Once again, thanks for your time and patience.
boliva is offline   Reply With Quote
Old 08-22-2008, 05:36 PM   #44 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: Montreal
Posts: 12
Default Good tip

I think I've finally gotten the hang of working with these things, and I found that putting easy to read NSLog commands at the beginnings of all of the viewDidLoad, viewWillAppear, etc. methods made it much easier to understand what was going on. You have to be careful to put your code in the right places, otherwise the views can't access the data. Just thought I'd put my two cents in. Thanks for all the help.
samson514 is offline   Reply With Quote
Old 08-23-2008, 08:56 AM   #45 (permalink)
Registered Member
 
Join Date: Aug 2008
Posts: 84
Default

If you just take a minute to learn interface builder you can set this up in about 5 seconds.
indiekiduk is offline   Reply With Quote
Old 08-23-2008, 09:05 AM   #46 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 361
Default

It can easily be done in IB, but learning the coding way to do it opens up far more possibilities

Last edited by DevTeamOfOne; 08-23-2008 at 09:08 AM.
DevTeamOfOne is offline   Reply With Quote
Old 08-23-2008, 09:10 AM   #47 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 361
Default

The issue people find, i believe is with adding many objects to IB Tab Bar.

There, you have issues as to how to create the more option.
DevTeamOfOne is offline   Reply With Quote
Old 08-23-2008, 09:11 AM   #48 (permalink)
Registered Member
 
Join Date: Aug 2008
Posts: 84
Default

Quote:
Originally Posted by DevTeamOfOne View Post
It can easily be done in IB, but learning the coding way to do it opens up far more possibilities
But learning the coding way correctly takes far more effort, and has a huge risk of leading to a bad design. Using IB kinda forces you onto the correct path Apple intended.
indiekiduk is offline   Reply With Quote
Old 08-23-2008, 09:13 AM   #49 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 361
Default

If you looked at my app you would find that mine has a rather great UI design. not much work either. Yes, it could, possibly, compromise design, but your goal as a developer is not to stick with Apple's guidelines to the letter. Its to bend them, and create a great UI in the process.

As for far more effort?

That kinda pays back in the "far more possibilites" area
DevTeamOfOne is offline   Reply With Quote
Old 08-23-2008, 09:20 AM   #50 (permalink)
Registered Member
 
Join Date: Aug 2008
Posts: 84
Default

There are 2 reasons why people are confused with tab applications:

Firstly the first view. This is the view that appears with the diagnoal lines on it. Click it and press delete. Now it looks normal and you know you need to now type in a nib name and set the class for that view. Then the view updates to "view loaded from FirstView.xib". I think that one tab view in the mainwindow nib and the other in another nib is confusing people.

Second is people don't know how to put Navigation controllers/table controllers inside the tab view so they can set other options in the inspector. It is in fact sooo easy to put a navigationcontroller inside a tab item view, its just a bit unobvious. Click the status bar of the tab bar controller icon in IB. Yes I said the status bar. Now you see something new in the inspector and you can set if you want the view to be a Navigation Controller or whatever. And now you can set other options on it including the initial title by double clicking the title.
indiekiduk is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 260
20 members and 240 guests
14DEV, @sandris, ADY, ArtieFufkin10, bookesp, ckgni, Dani77, DarkAn, HemiMG, iDifferent, IphoneSdk, jakerocheleau, JasonR, MACralik, NSeven, prchn4christ, Rudy, Speed
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,767
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:51 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0