ios6和ios7禁止屏幕旋转

时间:2014-07-14 15:44:43   收藏:0   阅读:329

 

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

评论(0)
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!