ios 在控制器中实现只支持竖屏
2016-07-12 本文已影响44人
忧零520
在主要的控制器中放入如下代码:
#pragma mark - 只支持横屏模式
- (BOOL)shouldAutorotate
{
return YES;
}
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return (toInterfaceOrientation == UIInterfaceOrientationPortrait);
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}