gpt4 book ai didi

ios - 在倒置肖像模式下关闭 VC 后,主 VC 显示为正常肖像

转载 作者:行者123 更新时间:2023-11-29 02:57:55 24 4
gpt4 key购买 nike

假设我有一个 View Controller ,我在 iPad 上显示如下:

[self presentViewController:self.someViewController animated:YES completion:nil];

并像这样解散:

[self.someViewController dismissViewControllerAnimated:YES completion:nil];

当我在倒置肖像模式下打开应用程序时它看起来不错,然后显示也支持倒置肖像的 VC,然后当我关闭它时,主 VC 将方向更改为正常肖像模式。为什么会这样?应该在哪里设置让它自动调整?

最佳答案

看起来 preferredInterfaceOrientationForPresentation 返回了 UIInterfaceOrientationPortrait,我将其修复如下:

 - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
//changed this:
// return UIInterfaceOrientationPortrait;
//to this:
return [UIApplication sharedApplication].statusBarOrientation;
}

它看起来像是一个合理的解决方案吗?

关于ios - 在倒置肖像模式下关闭 VC 后,主 VC 显示为正常肖像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23675627/

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