Back button not appearing on UINavigationController(UINavigationController 上未出现后退按钮)
问题描述
我的 AppDelegate 中有一个 UINavigationController 设置:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Add the navigation controller's view to the window and display.
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];
return YES;
}
在我的 RootViewController 中,我将另一个视图推入堆栈:
//Show the deals
DealViewController *dvc = [[DealViewController alloc] initWithNibName:@"DealViewController" bundle:nil];
[self.navigationController.navigationBar setHidden:NO];
[self.navigationController pushViewController:dvc animated:YES];
视图显示,但没有添加到我的导航栏的后退按钮.为什么会这样,我该如何解决?
The view shows up, but there is no back button that is added to my navigation bar. Why is this and how can I resolve it?
推荐答案
您必须将导航控制器视为一堆导航控制器,每个控制器控制一个充满信息的屏幕.您使用
You must think of the navigation controller as a stack of navigation controllers each controlling one screen full of information. You instantiate the navigation controller with the
-(id)initWithRootViewController:(UIViewController *)rootViewController
方法.您在此调用中指定根视图控制器.然后像以前一样将导航控制器的视图作为子视图添加到窗口中.
method. You specify the root view controller in this call. Then you add the navigation controller's view as a subview to the window, like you did before.
如果你想显示你的第二个屏幕,你可以通过使用将另一个视图控制器推送到堆栈上
If you want to show your second screen you push another view controller on the stack by using
-(void)pushViewController:detailViewController animated:YES
方法.
这篇关于UINavigationController 上未出现后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:UINavigationController 上未出现后退按钮
基础教程推荐
- Firebase 云消息传递令牌未生成 2022-01-01
- UINavigationBar 隐藏按钮文本 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 更改 UITableView 部分标题的颜色 2022-01-01
- 在视图控制器的宽度上水平均匀分布 UIButton 的最简单方法? 2022-01-01
- EditText 中的 setHintTextColor() 2022-01-01
- Android - 如何在runOnUiThread 中将数据传递给Runnable? 2022-01-01
- UINavigationItem 的持久 rightBarButtonItem 属性 2022-01-01
- 从 UIWebView 访问元数据 2022-01-01
- 在 iOS 7 下 CCMenu 错位 2022-01-01