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 ;
}