用這個(gè)方法在appDelegate適配
-(UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
//
if (_isHP == YES) {
[[NSNotificationCenter defaultCenter]postNotificationName:@"HPL" object:nil];
return UIInterfaceOrientationMaskAll; //四個(gè)方向
}else{
return UIInterfaceOrientationMaskPortrait; //豎直方向
}
}
- (BOOL)shouldAutorotate {
return YES;//支持轉(zhuǎn)屏
}
備注方向英文解釋
UIInterfaceOrientationMaskPortrait//home鍵在下 UIInterfaceOrientationMaskLandscapeLeft//支持向左旋轉(zhuǎn) UIInterfaceOrientationMaskLandscapeRight//支持向右旋轉(zhuǎn) UIInterfaceOrientationMaskPortraitUpsideDown//支持上下 UIInterfaceOrientationMaskLandscape//支持左右同時(shí)旋轉(zhuǎn) UIInterfaceOrientationMaskAll//支持四個(gè)方向 UIInterfaceOrientationMaskAllButUpsideDown//支持上左右