开发者

iPhone rotation on demand

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜