开发者

UIDeviceOrientationUnknown in landscape mode

开发者 https://www.devze.com 2022-12-14 09:11 出处:网络
I am trying to figure out what orientation the iphone has in the simulator and instead of giving it to me using the UIDevice orientation property I just get UIDeviceOrientationUnknown.

I am trying to figure out what orientation the iphone has in the simulator and instead of giving it to me using the UIDevice orientation property I just get UIDeviceOrientationUnknown.

Does this property not work in the simulator? What could be the possi开发者_如何学编程ble reason for this happening?

I am using opengl es


You can also use:

UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];  

which works even without calling beginGeneratingDeviceOrientationNotifications.


first of all, from the documentation about orientation property of UIDevice instance

The value of this property always returns 0 unless orientation notifications have been enabled by calling beginGeneratingDeviceOrientationNotifications.

and yes, it will work only on the real device. but you can use, for example, this accelerometer simulator.

0

精彩评论

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