强制设置页面横竖屏的问题

有的时候有的需求会让页面强制的横竖屏转换,再之后的ios的版本中,- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation被官方废弃了,不能继续使用的,下面是ios6之后的强制横竖屏的方法:

-(BOOL)shouldAutorotate

{

    return YES;

}

 

-(UIInterfaceOrientationMask)supportedInterfaceOrientations

{

    return UIInterfaceOrientationMaskLandscape;

}

 

-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation

{

    return UIInterfaceOrientationLandscapeRight;

}

 

-(BOOL)prefersStatusBarHidden

{

    return NO;

}

 还有一点需要说明的是,跳转到下一个页面强制横竖屏的时候只能使用presentViewController,而不能使用push跳转的方法,切记!!!

posted @ 2015-11-30 17:10  _Ace  阅读(193)  评论(0编辑  收藏  举报