首页 > 移动平台 > 详细

IOS屏幕旋转

时间:2015-05-26 01:39:28      阅读:184      评论:0      收藏:0      [点我收藏+]
//在iOS5.1 和 之前的版本中, 我们通常利用 shouldAutorotateToInterfaceOrientation: 来单独控制某个UIViewController的旋屏方向支持
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}

//但是在iOS6中,这个方法被废弃了,取而代之的是这俩个组合:
- (BOOL)shouldAutorotate
{
   return YES;
}
 
- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}


- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeRight;
}

//如果整个应用所有view controller都不支持旋屏
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window  
{  
     return UIInterfaceOrientationMaskPortrait;  
}


IOS屏幕旋转

原文:http://my.oschina.net/u/265368/blog/419895

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!