有什么简单的方法可以手动设置界面的方向吗?我需要将界面设置为纵向,即使设备方向在加载期间可能是横向的。有点想远离 CGAffineTransforms。
最佳答案
我知道一种对我有用的方法(有点 hack,可以在更改为您想要的方向之前显示一个方向)是:
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
UIApplication* application = [UIApplication sharedApplication];
if (application.statusBarOrientation != UIInterfaceOrientationPortrait)
{
UIViewController *c = [[UIViewController alloc]init];
[self presentModalViewController:c animated:NO];
[self dismissModalViewControllerAnimated:NO];
[c release];
}
}
关于ios - 手动设置界面方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7263985/