iphone - 在 iOS 上从横向 View 切换到纵向 View

标签 iphone ios uiview orientation

我的应用程序中有两个 View 。一个(默认情况下)是横向。当用户单击某个菜单时,我需要显示纵向 View 。

我已准备好所有代码,我正在尝试使用它:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

      return (interfaceOrientation == UIInterfaceOrientationPortrait);

}

但应用程序仍以横向显示下一个 View 。我想不通。任何帮助都会很棒。

最佳答案

You can not do it using navigation controller but if you are presenting your view then it  is possible to do that and make sure when you are presenting your view animation should be NO.
It works for me very well.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

关于iphone - 在 iOS 上从横向 View 切换到纵向 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12907606/

相关文章:

iphone - 为什么页面在我的 iOS 上的 jQuery Mobile PhoneGap 应用程序中转换后会闪烁?

ios - 页面错误显示有一处或多处错误

ios - MasterPass 集成 iOS

ios - UIView 的动画透视以向上/远离底部翻转一半

javascript - 如何在iPhone上使用windowScriptObject?

iphone - UILocalNotification 点击​​事件

ios - 构建我的项目时出现 Xcode 10 beta 错误?

ios - 在 IOS 中获取 CoreData

ios - Swift:全屏 UIImageView 不工作

iphone - 如何创建自定义 iOS View