change return from shouldAutorotateToInterfaceOrie

2019-06-14 04:03发布

I'm using shouldAutorotateToInterfaceOrientation: for respond YES to all orientations.

At runtime, in few case, i must change the return to YES only in portrait.

But if i change this return type, and my device not physicly turn, my interface orientation not change. How can it's possible to force uiView to check the shouldAutorotateToInterfaceOrientation: and rotate the view without UIdevice rotation notification.

Thanks a lot.

2条回答
男人必须洒脱
2楼-- · 2019-06-14 04:18

Static method starting from IOS 5:
[UIViewController attemptRotationToDeviceOrientation];

查看更多
对你真心纯属浪费
3楼-- · 2019-06-14 04:24

Add this two lines of code:

    [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
查看更多
登录 后发表回答