Arclin

Advocate Technology. Enjoy Technology.

0%

pop后强制竖屏

pop之后强制竖屏

AppDeleagte.h

1
2
3
4
5
6
7
// 控制全部不支持横屏,当allowRotation为YES的时候可以横/竖屏切换
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
if (self.allowRotation) {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
return UIInterfaceOrientationMaskPortrait;
}

pop之后强制竖屏

1
2
3
4
5
6
7
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];

// 强制竖屏
[[UIDevice currentDevice] setValue:@(UIDeviceOrientationPortrait) forKey:@"orientation"];
}