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;

複製代碼
相關文章
相關標籤/搜索