views:

13

answers:

1

Hi all, long time lurker first time poster :) I've been gradually skilling up on iPhone dev and have run into a hiccup - heres hoping someone out there can help me out.

I have made a very simple Navigation based app (UIViewController). The view has a single button on the Main RootViewController.

Next, I made 2 classes: TabOneViewController, TabTwoViewController. All good. I then created a new Class TabBarViewController. I opened up the NIB file and dropped on a ``UITabBarController onto it. The two tabs it creates in it by default were assigned (respectively) to my TabOne and TabTwo view controllers.

Then in my TabBarViewController, I made an IBOutlet for a UITabBarController, synthesized it etc etc. I linked it up in Interface builder via the "files owner".

In the RootViewController, I linked the button to my "pushView" method, and in this pushView method, I do the following:

- (IBAction) pushView {
    TabBarViewController *controller = [[TabBarViewController alloc] init];
    [self.navigationController pushViewController:controller animated:YES];
    [controller release];
}

The end result is it DOES push a view, but I cannot see the tab bar at the bottom, let alone any of the pages I've added to the controller.

If I create the Tab Bar progrmattically in my TabBarViewController.m it works like a charm:

- (void) viewDidLoad {
    UIView *uiView = [[UIView alloc] initWWithFrame:[[UIScreen mainScreen] applicationFrame]];
    self.view=uiView;
    [uiView release];

    TabOneViewController *tabOne = [[TabOneViewController alloc] init];
    TabTwoViewController *tabTwo = [[TabTwoViewController alloc] init];
    tabOne.title=@"Tab One";
    tabTwo.title=@"Tab Two";    

    tabBarController = [[UITabBarController alloc] init];
    tabBarController.view.frame = CGRectmake(0, 0, 320, 460);
    [tabBarController setViewControllers: [NSArray arrayWithObjects: tabOne, tabTwo, nil]];

    [tabOne release];
    [tabTwo release];

    [self.view addSubView:tabBarController.view];
}   

What am I doing wrong? Why can't I link it in IB?

A: 

Anyone have any hints for me?

Matt