views:

86

answers:

1

I've been trying to learn iPhone development by making a sample app, and now I'm stuck trying to get a UITabBarController to be shown. I have an custom view Controller with the NIB -file containing the Tab Bar Controller:

alt text

In my controller's .h I've defined an IBOutlet for the UITabBarController:

IBOutlet UITabBarController *tabController;

And I've defined the @property for the same variable:

@property (nonatomic, retain) IBOutlet UITabBarController *tabController;

Then in the AppDelegate I try to use the UITabBarController to show the tab bar:

NetworkViewController *controllerInst = [[NetworkViewController alloc] initWithNibName:@"NetworkViewController" bundle:[NSBundle mainBundle]];
[self setNetworkController:controllerInst];
[controllerInst release];
[window addSubview:[[networkController tabController] view]];

[window makeKeyAndVisible];

The Tab Bar Controller has been linked to the Outlet (as the image above shows).

I really am new to Objective-C and iPhone development, so it's ok if your answer is "You're going about this all wrong..." ;)

A: 

These should help you get started
http://www.amateurinmotion.com/articles/2009/01/24/creating-uitabbarcontroller-based-app-using-interfacebuilder.html
http://www.edwardbenson.com/2008/12/21/uitabbarcontroller-example/

zapping
The second link actually did it ;)The problem was that I was adding the UITabBarController to the NIB -file of a created UIViewController whereas I should have added it to the MainWindow.xib file and handled it from the AppDelegate. Thanks!
TuomasR