pushViewController Not Displaying UIView/Nib with tabbar and nav bar

Posted by james on Stack Overflow See other posts from Stack Overflow or by james
Published on 2010-05-03T06:14:38Z Indexed on 2010/05/03 6:18 UTC
Read the original article Hit count: 492

I'm relatively new to objective c but not programming and am stuck with my iphone app.

I created a nav based app with both a navbar and a tab bar controller. I set the tab bar as the root controller. I'm able to switch between each tab without any issues to various UIViews and UITableViews.

My issue is that in one of my UITableViews that I call from the TabBarController, didSelectRowAtIndexPath function is suppose to display a new UIView. The below code does not give any errors and runs fine but does not show the new Nib.

if(newViewController == nil) {
NSLog(@"yes nil");
BookViewController *aNewViewController = [[BookViewController alloc] initWithNibName:@"BookOptionView" bundle:nil]; self.newViewController = aNewViewController; [aNewViewController release]; } BookAppDelegate *delegate = (BookAppDelegate *)[[UIApplication sharedApplication] delegate]; [delegate.appNavBar pushViewController:newViewController animated:YES];

Now when I do the below, it works fine but it gets rid of the nav and tab which I'm assuming because its a modal call instead of pushing the view controller.

BookViewController *screen = [[BookViewController alloc] initWithNibName:@"BookOptionView" bundle:[NSBundle mainBundle]]; screen.modalTransitionStyle = UIModalTransitionStyleCoverVertical; [self presentModalViewController:screen animated:YES]; [screen release];

Any ideas why I can't get the View Controller to push correctly? In my application delegate file, I declared an AppNavBarController object (inherit from UINavigationController) called appNavBar.

Any help would be appreciated!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uinavigationcontroller