gpt4 book ai didi

iOS 7 - 仅在一个 View Controller 中限制横向方向

转载 作者:可可西里 更新时间:2023-11-01 03:07:08 24 4
gpt4 key购买 nike

我只需要在纵向模式下打开第一个 View Controller 。作为其余 View Controller 将使用两个方向。所以我在 plist 文件中添加了两个方向。

-(BOOL) shouldAutorotate {
//Never called
}

- (NSUInteger) supportedInterfaceOrientations {
//Never called
}

谁能告诉我怎么限制

最佳答案

只需创建 UINavigationController 类并覆盖即可修复它

-(NSUInteger)supportedInterfaceOrientations
{
AppDelegate *appDelegate = (AppDelegate *) [UIApplication sharedApplication].delegate;
if(appDelegate.isOrientationOn) {
return UIInterfaceOrientationMaskAll;
}
return UIInterfaceOrientationMaskPortrait;
}

在根窗口中使用这个自定义导航 Controller 类就可以了。

关于iOS 7 - 仅在一个 View Controller 中限制横向方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19768620/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com