ios - 如何使用 UISplitViewController iOS 在 iPad 上强制以纵向模式显示 MasterViewController

标签 ios objective-c swift uisplitviewcontroller

我正在使用 UISplitViewController 制作应用程序,但它需要在 iPad 中的纵向模式下仅显示 MasterViewController(与 iPhone 上的纵向模式相同)。横屏模式下正常工作。

请给我一些想法来实现它。提前致谢。

最佳答案

将其放入viewWillAppear

NSNumber *value = [NSNumber numberWithInt: UIInterfaceOrientationMaskPortrait];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];

关于ios - 如何使用 UISplitViewController iOS 在 iPad 上强制以纵向模式显示 MasterViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38157247/

相关文章:

ios - 我怎么知道用户是否以相同的 ID 登录其他设备,我在我的应用程序中使用了 XMPP

ios - 哪个对象的数组具有最多的特定对象

ios - 基于导航的应用程序,支持尺寸类别和 iOS 8

swift - 是否可以使 MGLPolyLines 可选? - swift , map 框

ios - 使用来自 Parse.com 的 createdAt 日期时的 NSDate 准确性

ios - 初始化后从未调用 Realm 通知

ios - 停止检测 Apple Vision、iOS、Swift 中的字母

swift - 呈现 View Controller 时如何在 iOS13 中获取可见 View 大小

ios - 静音时播放声音

objective-c - Objective C unicode 字符比较