gpt4 book ai didi

iphone - IOS 7 + 对于力 Controller 方向为纵向

转载 作者:行者123 更新时间:2023-12-03 20:51:12 26 4
gpt4 key购买 nike

我对 IO6 及以下代码使用了以下代码来强制旋转:

-(void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
UIApplication* application = [UIApplication sharedApplication];
if (application.statusBarOrientation != UIInterfaceOrientationPortrait)
{
UIViewController *c = [[UIViewController alloc]init];
[c.view setBackgroundColor:[UIColor redColor]];
[self.navigationController presentViewController:c animated:NO completion:^{
[self.navigationController dismissViewControllerAnimated:NO completion:^{
}];
}];
}
}

但它在 IOS7 上无法正常工作,它旋转 View Controller ,但再次在屏幕上设置空白 View ...

你能帮我解决 IOS 7 中的这个问题吗...

最佳答案

更改此行:

[self.navigationController dismissViewControllerAnimated:NO completion:^{
}];

对此:

[self.navigationController dismissViewControllerAnimated:YES completion:^{
}];

关于iphone - IOS 7 + 对于力 Controller 方向为纵向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19034627/

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