开发者

iPhone rotation on demand

开发者 https://www.devze.com 2023-02-02 20:13 出处:网络
Is there a way to manually check current position of device AND ask开发者_JAVA百科 device to automatically rotate it without waiting for user to actually rotate the device?

Is there a way to manually check current position of device AND ask开发者_JAVA百科 device to automatically rotate it without waiting for user to actually rotate the device?

Currently I control the rotation with several IFs in -shouldAutorotateToInterfaceOrientation but in few situations I have to stop the view from rotating and enable it again and I don't want user to rotate the device twice to have the desired orientation.


for checking Orientation

UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];

then based on your condition you can change device orientation as you wish..

you can use :

[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationPortrait;

or what ever you want.

or you can go for following but this is not do

[[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait];
0

精彩评论

暂无评论...
验证码 换一张
取 消