我的应用程序使用导航 Controller ,我正在尝试插入横向支持! 我有我的 NavigationController 和一个 View ,它使用以下代码通过 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));
}
有什么问题? 它可以工作,但是当您触摸从堆栈弹出 View 的按钮时,它不是从右向左滚动,而是从上向下滚动!
你知道可能是什么问题吗? 谢谢!
最佳答案
我猜你有一个 UINavigationController
在 UITabBarController
里面?
解决方案是覆盖 shouldAutorotateToInterfaceOrientation:
导航堆栈中每个 View Controller 的方法(最后一个不是必需的)并返回 YES
对于支持的方向
关于ios - 横向导航 Controller ,弹出向上滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4845602/