关于ios6.0和5.0的横竖屏支持方法
iOS6.0中抛弃了- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation的方法对横竖屏切换的支持,
ios6.0中的对横竖切换的支持步骤为
第一
info.plist中Supported interface orientations中加入支持的方向第二 在
AppDelegate中加入 -(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{ return UIInterfaceOrientationMaskAll;} 第三 你想控制旋转的界面 -(NSUInteger)supportedInterfaceOrientations{ return UIInterfaceOrientationMaskPortrait; // 可以修改为任何方向 } -(BOOL)shouldAutorotate{ return YES; }5.0的是 -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{ return (toInterfaceOrientation == UIInterfaceOrientationPortrait); // 你在这返回的参数中可以修改为任何你想支持方向 }

浙公网安备 33010602011771号