我有一个 iPhone 应用程序,我目前正在将其转换为 通用二进制文件 以使用iPad.我已经成功实现了我在布局方面所需的一切,因此我的应用现在支持完整的横向功能(以前我主要使用纵向模式来显示内容).
I have an iPhone application that I am currently converting to a universal binary to work with the iPad. I have successfully implemented everything I need in terms of layout so that full landscape functionality is now supported in my app (previously I primarily used portrait mode to display content).
但是,我有一个奇怪的问题,它只发生在横向模式下:当我将视图控制器推入堆栈时,需要 两次点击后退按钮才能返回到上一个视图控制器!第一次点击显示一个空白视图,但在左侧的后退导航按钮上具有相同的名称,第二次点击将控制器返回到之前的视图.
But, I have one strange problem, and it ONLY occurs in landscape mode: when I push a view controller onto the stack, it takes two taps on the back button to return to the previous view controller! The first tap shows a blank view, but with the same name on the left-side back navigation button, the second tap takes the controller back to previous view like it should.
我没有要测试的 iPad,所以我依赖模拟器.该问题不会出现在 iPhone 上,并且如果您旋转回纵向模式也不会出现.
I don't have an iPad to test, so I am relying on the simulator. The problem does not show up on the iPhone and doesn't show up if you rotate back to portrait mode.
我的应用由一个 tabbarcontroller 和为其 vc 加载的导航控制器组成:
My app consists of a tabbarcontroller with navigation controllers loaded for its vc's:
//application delegate
- (void)applicationDidFinishLaunching:(UIApplication *)application
//....
WebHelpViewController *vc8 = [[WebHelpViewController alloc] init];
UINavigationController *nv8 = [[UINavigationController alloc] initWithRootViewController:vc8];
[self.tabBarController setViewControllers:[NSArray arrayWithObjects:nv1,nv2,nv3,nv4,nv5,nv6,nv7,nv8,nil]];
为了实现横向功能,UITabBarController 被覆盖以在需要时自动旋转:
To implement landscape capability, the UITabBarController is overridden to autorotate when required:
//CustomTabBarController.m
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return [[(UINavigationController *)self.selectedViewController topViewController] shouldAutorotateToInterfaceOrientation:interfaceOrientation];
}
... 工作正常.我使用这种方法导航到新视图
... works fine. I navigate into new views using this method
SomeViewController *vc = [[SomeViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
[vc release];
这只是模拟错误吗?我该如何解决这个问题?
Is this only a simulation error? How do I fix this problem?
听起来好像另一个 ViewController
正在响应:
It sounds like another ViewController
is responding to:
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
先检查一下.
这篇关于UINavigationController 横向模式下的导航堆栈问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!