首页 > 移动平台 > 详细

iOS中的屏幕旋转

时间:2014-12-06 15:28:35      阅读:261      评论:0      收藏:0      [点我收藏+]

2种方法

应用级别控制

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window

{

    returnUIInterfaceOrientationMaskAll;

}


视图控制器控制

//iOS 6-

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation

{

    if (toInterfaceOrientation ==UIInterfaceOrientationLandscapeLeft | toInterfaceOrientation ==UIInterfaceOrientationLandscapeRight)

    {

        return YES;

    }

    else

    {

        return NO;

    }

}


//iOS 6+

- (BOOL)shouldAutorotate

{

    return YES;

}

- (NSUInteger)supportedInterfaceOrientations

{

//    return UIInterfaceOrientationMaskLandscape;

    returnUIInterfaceOrientationMaskAll;

}

注意:

如果控制器的父控制器为导航控制器或TabBar控制器,要在导航控制器或者TabBar控制器修改在导航控制器或者Tab控制器的子控制器修改是没效的。



iOS中的屏幕旋转

原文:http://blog.csdn.net/isharestudio/article/details/41774893

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