2011-08-04 89 views
0

我想模态显示设置表,但我无法在顶部(显示标题和完成按钮)获得导航栏。我可以添加酒吧作为一个子视图到tableview中,但随后与tableview中滚动,我想将它留在原地的顶部。如何将导航栏添加到表格视图?

回答

0

如果你是显示它有模式,你可以做这样的事情。在这里,我试图表明EnterScreenController模态,我在上面加一个导航栏是这样的。

EnterScreenController *enterScreenController = [[EnterScreenController alloc] initWithNibName:@"EnterScreenController" bundle:[NSBundle mainBundle]]; 

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:enterScreenController]; 

navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 

[self presentModalViewController:navController animated:YES]; 
+0

这是好事,谢谢。 – Randall

+0

np ............. :) – Legolas

1

解决这个问题的最好的办法是在之前看来声明一个UINavigationController,然后你没有在当前视图中断的tableview行为自动获得导航栏。从AppDelegate中

例子:

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
self.viewController = [[ViewTestViewController alloc] initWithNibName:@"ViewTestViewController" bundle:nil]; 
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:self.viewController]; 
self.window.rootViewController = nav; 
[self.window makeKeyAndVisible]; 
return YES; 
相关问题