MXRotationManager, 一行代码控制iOS设备旋转方向UIInterfaceOrientationMask

代码demo已在Github开源, MXRotationManager, 若是能帮助到您,请帮忙点个星star哈,谢谢!git

MXRotationManager 一行代码控制iOS设备旋转方向UIInterfaceOrientationMaskgithub

屏幕截图

UIDeviceOrientationLandscapeLeft UIDeviceOrientationLandscapeRight
UIDeviceOrientationLandscapeLeft
UIDeviceOrientationLandscapeRight

如何使用

AppDelegate.m里 实现 AppDelegate 代理方法bash

- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    return [MXRotationManager defaultManager].interfaceOrientationMask;
}
复制代码

UIDeviceOrientationLandscapeLeft

[MXRotationManager defaultManager].orientation = UIDeviceOrientationLandscapeLeft;
复制代码

UIDeviceOrientationLandscapeRight

[MXRotationManager defaultManager].orientation = UIDeviceOrientationLandscapeRight;

复制代码
相关文章
相关标签/搜索