美文网首页
MXRotationManager, 一行代码控制iOS设备旋转

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

作者: 穿山甲到底说了什么 | 来源:发表于2018-12-02 15:11 被阅读0次

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

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

屏幕截图

UIDeviceOrientationLandscapeLeft UIDeviceOrientationLandscapeRight
UIDeviceOrientationLandscapeLeft UIDeviceOrientationLandscapeRight

如何使用

AppDelegate.m里 实现 AppDelegate 代理方法

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

UIDeviceOrientationLandscapeLeft

[MXRotationManager defaultManager].orientation = UIDeviceOrientationLandscapeLeft;

UIDeviceOrientationLandscapeRight

    [MXRotationManager defaultManager].orientation = UIDeviceOrientationLandscapeRight;

相关文章

网友评论

      本文标题:MXRotationManager, 一行代码控制iOS设备旋转

      本文链接:https://www.haomeiwen.com/subject/yhvjcqtx.html