问题
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.
回答1:
Add this two lines of code:
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
回答2:
Static method starting from IOS 5: [UIViewController attemptRotationToDeviceOrientation];
来源:https://stackoverflow.com/questions/6518961/change-return-from-shouldautorotatetointerfaceorientation-at-runtime