ios6和ios7禁止屏幕旋转

 

ios6和ios7禁止屏幕旋转ios

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientationapp

{iphone

    return (toInterfaceOrientation == UIInterfaceOrientationPortrait);ip

}it

- (BOOL)shouldAutorotateio

{ios7

    return NO;方法

}di

- (NSUInteger)supportedInterfaceOrientationsios6

{

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

}这些方法不行 

再。。。。。

在appdelegate中添加以下代码

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

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

        return UIInterfaceOrientationMaskAll;

    else  /* iphone */

        return UIInterfaceOrientationMaskPortrait ;

}

相关文章
相关标签/搜索