导航控制器在风景,流行滚动向上

时间:2011-01-30 21:17:42

标签: iphone uinavigationcontroller landscape pop

我的应用程序使用导航控制器,我正在尝试插入景观支持! 我有我的NavigationController和一个视图,使用此代码通过IBAction(在UIButton连接)调用:

view *myview = [[view alloc] initWithNibName:@"view" bundle:[NSBundle mainBundle]];
[self pushViewController:myview animated:YES];

当然,我在NavigationController_Class

中导入了“myview.h”

因此,对于格局,我已将此代码插入“myview.m”和“NavigationController_Class.m”中

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 return ((interfaceOrientation == UIInterfaceOrientationPortrait) || (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) || (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
 }

有什么问题? 它可以工作,但当你从堆栈中触摸视图弹出按钮时,这不会从右向左滚动,而是从向上滚动到向下滚动!

你知道可能是什么问题吗? 谢谢!

1 个答案:

答案 0 :(得分:3)

我猜你在UINavigationController里面有一个UITabBarController

解决方案是覆盖导航堆栈中每个视图控制器的shouldAutorotateToInterfaceOrientation:方法(最后一个不是必需的)并返回YES以获得支持的方向

相关问题