横向模式下的UINavigationController导航堆栈问题 [英] UINavigationController navigation stack problems in landscape mode

查看:118
本文介绍了横向模式下的UINavigationController导航堆栈问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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导航堆栈问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆