gpt4 book ai didi

ios - 在 Storyboard中支持 UIViewController 的纵向方向模式

转载 作者:行者123 更新时间:2023-11-28 20:21:40 25 4
gpt4 key购买 nike

我使用 Storyboard创建了 UIViewController 并将其链接到 UIViewController 类。

我想让我的UIViewController只支持Portrait Orientation,我试了blow代码,但是好像不行。我的 UIViewController 仍在旋转。

我需要更改 Storyboard 中的任何属性吗?

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

return ((interfaceOrientation == UIInterfaceOrientationPortrait) || (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown));
}

最佳答案

shouldAutorotateToInterfaceOrientation 在 iOS6 中已弃用,您应该使用 shouldAutoRotatesupportedInterfaceOrientations

在您的 viewController 中这样尝试。

- (BOOL)shouldAutorotate {
return NO;
}

- (BOOL)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}

关于ios - 在 Storyboard中支持 UIViewController 的纵向方向模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15663977/

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