Skip to content

Latest commit

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

iOSRotationScreen

屏幕旋转、横竖屏切换

AppDelegate

- (UIInterfaceOrientationMask)application:(UIApplication *)application
supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return [SupportedInterfaceOrientations sharedInstance].orientationMask;
}

使用例子

#pragma mark - 竖屏
- (void)rotationPortrait
{
[SupportedInterfaceOrientations sharedInstance].orientationMask = UIInterfaceOrientationMaskPortrait;
NSNumber *orientationValue = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
[[UIDevice currentDevice] setValue:orientationValue forKey:@"orientation"];
}
#pragma mark - 横屏
- (void)rotationLandscape
{
[SupportedInterfaceOrientations sharedInstance].orientationMask = UIInterfaceOrientationMaskLandscape;
NSNumber *orientationValue = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
[[UIDevice currentDevice] setValue:orientationValue forKey:@"orientation"];
}

About

屏幕旋转、横竖屏切换

Topics

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages