如何以编程方式将导航栏添加到presentModalViewController? 我知道默认的导航栏将在pushViewController .. 希望你的帮助...如何以编程方式将导航栏添加到presentModalViewController?
1
A
回答
4
使用viewDidLoad中的这段代码。
UINavigationBar *myBar = [[UINavigationBar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
[self.view addSubview:myBar];
这会将导航栏添加到您的视图。
1
这可以帮助你
PopoverView *foo = [[PopoverView alloc] initWithNibName:@"PopoverView" bundle:nil];
// Here you pass through properties if you need too.
// ...
UINavigationController *navC = [[UINavigationController alloc] initWithRootView:foo];
[foo release];
[self.navigationController presentModalViewController:navC animated:YES];
那你是怎么添加一个导航栏,以模态。
1
尝试添加以下内容到浏览做负载
[self.navigationController setNavigationBarHidden:NO animated:YES];
+0
我不知道,这不适合我。我在viewDidLoad中尝试了这两种方法,并且当呈现视图控制器实例化呈现的控制器时 – SimplGy 2015-07-22 20:31:36
相关问题
- 1. 以编程方式将按钮添加到导航栏
- 2. 如何以编程方式将导航栏添加到我的应用程序?
- 3. 将按钮添加到导航栏并以编程方式显示
- 4. 以编程方式将选择器添加到导航栏按钮
- 5. 以编程方式添加导航栏iOS
- 6. 如何以编程方式将UIButton添加到工具栏上?
- 7. 如何以编程方式将工具栏添加到LinearLayout
- 8. 如何将导航栏添加到PyDev?
- 9. 如何将UIBarButtonItem添加到导航栏?
- 10. 如何将导航栏添加到UITableView
- 11. 如何以编程方式打开引导移动导航栏?
- 12. 如何以编程方式添加实际适合屏幕的导航栏?
- 13. 如何以编程方式在导航栏中添加下拉菜单?
- 14. 如何以编程方式将组添加到导航抽屉中
- 15. 如何以编程方式添加导航控制器?
- 16. 如何以编程方式添加多个导航控制器?
- 17. 如何以编程方式添加导航控制器?
- 18. 如何将徽标添加到Twitter引导程序导航栏?
- 19. jQuery的编程方式添加导航栏元素移动
- 20. 如何以编程方式创建自定义导航栏?
- 21. 如何以编程方式设置导航栏的位置
- 22. 如何以编程方式将离子按钮添加到离子导航栏? (Ionic 2,Angular 2)
- 23. 添加导航栏编程到tableviewController(赛格瑞推或模式)
- 24. 以编程方式添加UINavigation栏
- 25. 添加导航栏的UITableView编程
- 26. 如何将导航添加到模式
- 27. Android将按钮以编程方式添加到工具栏
- 28. 以编程方式将工具栏添加到Android中的RelativeView
- 29. 以编程方式将UILabel添加到工具栏
- 30. 以编程方式将标签添加到标签栏
的可能重复的[添加导航栏,以编程的UITableViewController?](http://stackoverflow.com/questions/2700990/adding-a-navigationbar-to -uitableviewcontroller-programmingmatically) – rmaddy 2013-02-13 04:18:17
UINavigationController * navController = [[[UINavigationController alloc] initWithRootViewController:tableViewController] autorelease]; [self presentModalViewController:navController animated:YES];试试这个 – 2013-02-13 04:20:43
您可以通过拖放操作直接从界面生成器中将导航栏添加到xib文件中。 – 2013-02-13 04:31:43