IPAD direction returns unknown value

I use this code:

UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];

Get the iPad orientation, but in When rendering with OpenGL, it returns UIDeviceOrientationUnknown. When I play a movie or show UIViews, it returns the correct value. Do you know how I can get the correct orientation? I don’t want to use an accelerometer because I want to know when the device locks its orientation.

Thank you!

In some cases, the accelerometer cannot accurately read the direction, such as when the device remains flat .You can still use the following methods to get the current orientation:

UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];

I use this code:

UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];

Get the iPad orientation, but return UIDeviceOrientationUnknown when using OpenGL rendering. When I play a movie or show UIViews, it returns the correct value. Do you know how I can get the correct direction? I don’t want to use an accelerometer because I want to know when the device locks its orientation.

Thank you!

In some cases, the accelerometer cannot accurately read the direction, such as when the device remains flat. You can still use the following methods to get the current direction: < p>

UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 991 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.