开发者

Navigation Controller and Table Views

I am creating an application which I want to have a view controller with buttons as the first view controller with no navigation ba开发者_运维技巧r, and then when the user selects a button a table view controller appears managed by a navigation controller.

At the moment I am setting up the navigation controller in the app delegate and setting the top view controller as the table view controller I want to start the navigation bar on. So far I can see the navigation bar but that is it when I transition from the first view controller to the table view controller.

Any help would be much appreciated as I have confused myself with this issue.


I'm not totally clear on what you are asking, so I might have it wrong, but here goes. The top navigation bar is can be displayed or hidden by calling:

self.navigationController.navigationBarHidden = NO;

In the viewWillAppear method of your viewController. So set it to YES or NO depending on whether or not you want it to be displayed.


@Disco, you would do something like so:

// In the App delegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
  CustomViewController *viewController = [[CustomViewController alloc] init];
  [window addSubview:viewController.view];
  [window makeKeyAndVisible];
  return YES;
}

// In your button method
- (IBAction)loadUpTableViewController:(id)sender {
  CustomTableViewController *tvc = [[CustomTableViewController alloc] init];
  UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:tvc];
  [self presentModalViewController:navigationController animated:YES];
  [navigationController release];
  [tvc release];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜