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

2018-12-02  本文已影响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;

上一篇下一篇

猜你喜欢

热点阅读