iPhone - 导航栏后退按钮项目没有响应

标签 iphone uinavigationitem

我有一个全屏模态视图,如下所示:

PreferencesController *nextWindow = [[[PreferencesController alloc] initWithNibName:@"Preferences" bundle:nil] autorelease];
UINavigationController* navController = [[[UINavigationController alloc] initWithRootViewController:nextWindow] autorelease];
[self presentModalViewController:navController animated:YES];

然后从这个 modalView 中我推送另一个 View :

    MyController *nextWindow = [[[MyController alloc] initWithNibName:@"tmp" bundle:nil] autorelease];
    [self.navigationController pushViewController:nextWindow animated:YES];

在这个新 Controller 中,我有这个 viewDidLoad :

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = @"Borders";
    self.navigationController.navigationBarHidden = NO;
}

leftBarButtonItem 未处于事件状态,我的意思是触摸它不会突出显示它,也不会返回到上一个 View 。

我的 View 全屏显示,并在应用程序初始化时调用 [[UIApplication shareApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];

导航栏框架为 0,0,320,44。
navigationBar super View 框架是0,0,320,480。
viewController View 框架为 0,0,320,436。

我尝试调用 viewDidLoad self.navigationController.navigationBar.userInteractionEnabled = YES;self.navigationItem.leftBarButtonItem.enabled = YES; 但没有效果。

会发生什么?

编辑:
我的 self.navigationController.navigationItem.backBarButtonItem 为 NIL。 self.navigationController.navigationItem 不是 NIL

最佳答案

每当我遇到这种 react 迟钝的情况时,总是因为框架问题。即 NavigationController 的 super View 小于 NavigationController 的 View 。我知道您说所有内容都设置为全屏,但我会通过为层次结构中的每个 View 打开“clipsSubviews”来验证所有内容实际上都是全屏。

关于iPhone - 导航栏后退按钮项目没有响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5362877/

相关文章:

ios - 在 ios 应用程序中下载带有 .m3u8 url 的视频

iphone - 制作简单的基于文本的 iphone 应用程序的简单方法是什么

ios - 为什么我的 leftBarButtonItem 在 iOS 11.4 上呈现得更小

iPhone 应用程序 - 自定义 B2B 应用程序

ios - Thread 1 :EXC_BAD_ACCESS(code=1, address=0x20004018) 如何解决?

ios - 只为 iPhone 上的所有版本提供 3x 图像是否足够?

swift - 导航栏上后退按钮上的字体(Swift)

ios - 如何向已有的 Storyboard添加后退按钮和导航栏?

swift - UINavigationBar添加搜索按钮 : Swift

objective-c - 使用UINavigationItem类的属性leftItemsSupplementBackButton