iphone - 强制 UIViewController 加载特定方向

标签 iphone ios ipad rotation uiinterfaceorientation

因此,在我的应用程序中,我有一个导航堆栈,用户可以在其中浏览各种 View Controller 。某些 View 支持多个方向,而其中一个 View 则不支持。所以我的问题是,如何强制一个特定的 UIViewController 仅以一种方向显示。我需要这个在第一次加载 View 时以及当另一个 View 弹出并且该 View 再次可见时工作。谢谢

我实现了这两种方法来控制 View 的旋转:

-(void)orientationDidChange:(NSNotification *)notification
-(BOOL)shouldAutoRotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

谢谢

最佳答案

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

关于iphone - 强制 UIViewController 加载特定方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8830039/

相关文章:

ios - 无法正确渲染 "UIGraphicsBeginImageContextWithOptions"

ios - UITableViewController子类和UISplitViewController委托(delegate)问题

iphone - 如何使用 V2 Box iOS SDK 获取创建者和上次修改日期

iphone - 使用 CCTMXLayer 处理大型 map

iphone - iPhone 和 iPod Touch 上为 "security policy error"

ios - 为什么我的变量的值在Swift中恢复?

iphone - 如何调用本 map 片文件并显示到imageviewcontroller中

ios - iPhone 6 Plus 上的 UIImage 缩放

iphone - 由于太多未处理的消息而丢弃事件 0 的消息

Swift 4 相机 View 在 iPad 上出现在侧面