代碼demo已在Github開源, MXRotationManager, 如果能幫助到您,請幫忙點(diǎn)個(gè)星star哈,謝謝!
MXRotationManager 一行代碼控制iOS設(shè)備旋轉(zhuǎn)方向UIInterfaceOrientationMask
屏幕截圖
| UIDeviceOrientationLandscapeLeft | UIDeviceOrientationLandscapeRight |
|---|---|
![]() UIDeviceOrientationLandscapeLeft
|
![]() UIDeviceOrientationLandscapeRight
|
如何使用
在 AppDelegate.m里 實(shí)現(xiàn) AppDelegate 代理方法
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
return [MXRotationManager defaultManager].interfaceOrientationMask;
}
UIDeviceOrientationLandscapeLeft
[MXRotationManager defaultManager].orientation = UIDeviceOrientationLandscapeLeft;
UIDeviceOrientationLandscapeRight
[MXRotationManager defaultManager].orientation = UIDeviceOrientationLandscapeRight;

