ios - 横向导航 Controller ,弹出向上滚动

标签 ios swift uinavigationcontroller landscape

我的应用程序使用导航 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 的按钮时,它不是从右向左滚动,而是从上向下滚动!

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

最佳答案

我猜你有一个 UINavigationControllerUITabBarController 里面?

解决方案是覆盖 shouldAutorotateToInterfaceOrientation:导航堆栈中每个 View Controller 的方法(最后一个不是必需的)并返回 YES对于支持的方向

关于ios - 横向导航 Controller ,弹出向上滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4845602/

相关文章:

ios - 为什么每次我打开 xcode 项目时它都会显示撤销代码签名证书?

ios - 使用 AVQueuePlayer 跳到上一个的更好方法?

ios - 如何弹回 TableViewController?

ios - 目录神奇地变成文件

ios - 是否可以合并我的 Storyboard和我从 GitHub 下载的其他人的 Storyboard?

ios - UICollectionViewCell 不出现

ios - swift 4 : Unable to push ViewController upon button click.

swift - 在 swift 中使用 stride 的优势

arrays - 如何将字典加载到 UIPickerView

iphone - 在 View 导航时在 UITableView 中显示数据