开发者

How do I check the orientation of the device?

I'm loo开发者_运维问答king for a quick way to tell if the device is being held with the home button to the right or to the left. Is there a function to do so?


Look at the UIDevice documentation. There is an orientation property available. Something like:

UIDeviceOrientation d = [[UIDevice currentDevice] orientation];

The values of d you are looking for are:

UIDeviceOrientationLandscapeLeft - The device is in landscape mode, with the device held upright and the home button on the right side.

UIDeviceOrientationLandscapeRight - The device is in landscape mode, with the device held upright and the home button on the left side.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜