在ios中,我用storyboard写一个应用。需要有横屏和竖屏。并且都不能旋转。我在工程中,选择了两个模式,即横屏和竖屏,然后在一个viewcontroller中,添加了一下这些函数,期望这个只支持横屏:
- (BOOL)shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
但是当我旋转屏幕的时候,屏幕还是跟着旋转了。
我以前一个app用xib的方式,就没碰到这个问题。请教。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
业精于勤,荒于嬉;行成于思,毁于随。