在AppDelegate中增加,这个方法可以禁止横屏
1 - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window 2 { 3 return UIInterfaceOrientationMaskPortrait; 4 }