ios6和ios7禁止屏幕旋转

时间:2014-07-14 15:45:00   收藏:0   阅读:381

 

ios6和ios7禁止屏幕旋转

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation

{

    return (toInterfaceOrientation == UIInterfaceOrientationPortrait);

}

- (BOOL)shouldAutorotate

{

    return NO;

}

- (NSUInteger)supportedInterfaceOrientations

{

    return UIInterfaceOrientationMaskPortrait;//只支持这一个方向(正常的方向)

}这些方法不行 

再。。。。。

在appdelegate中添加如下代码

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

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

        return UIInterfaceOrientationMaskAll;

    else  /* iphone */

        return UIInterfaceOrientationMaskPortrait ;

}

 

ios6和ios7禁止屏幕旋转,布布扣,bubuko.com

原文:http://www.cnblogs.com/zhujin/p/3842607.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!