UIBarButtonItem 更改 viewController 的方向
我得到了一个带有 .rightBarButtonItem
的 UINavigationBar
。如果我点击它,它会推送新的 viewController
并自动弹出一个 .leftBarButtonItem
,这会将我带到之前的 viewController
。
问题是(当我点击 .leftBarButtonItem
时)方向从横向模式更改为纵向模式,尽管我希望应用程序保持横向模式。我该如何解决这个问题?
多谢!
I got a UINavigationBar
with an .rightBarButtonItem
. If I tap on it, it pushes the new viewController
and a .leftBarButtonItem
is brought up automatically which takes me to the viewController
I was before.
The problem is (when I tap on the .leftBarButtonItem
) that the orientation is changed from landscape to portrait mode, though I want the app to stay in landscape mode. How can I fix that?
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
目前尚不清楚在按下右侧按钮栏项目之前您是否处于纵向模式。
听起来第一个视图控制器的 shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 对于纵向方向没有返回 YES。
It's not clear if you were in portrait mode before you pressed the right button bar item.
It sounds like the first view controller's shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation isn't returning YES for portrait orientations.