Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know current interfaceOrientation in iOS 8?

Now that interfaceOrientation propery in UIViewController is deprecated, what is the recommended way to detect current device orientation?

like image 228
cocoapriest Avatar asked Dec 04 '22 04:12

cocoapriest


1 Answers

You can use [UIApplication sharedApplication].statusBarOrientation

Pay attention that [[UIDevice currentDevice] orientation] is not exactly like your application rotation. The docs:

Discussion: The value of the property is a constant that indicates the current orientation of the device. This value represents the physical orientation of the device and may be different from the current orientation of your application’s user interface. See UIDeviceOrientation for descriptions of the possible values.

I would check if the statusBarOrientation works.

like image 156
oren Avatar answered Dec 21 '22 02:12

oren