Breaking News
Home / iOS / iOS Snippets / How to find iPad Device Orientation?

How to find iPad Device Orientation?

iPad Device OrientationIn order to properly display/render you view, knowing the orientation of iPad is must. There are couple of ways to do so using the UIDevice API, Notification Center and Status Bar Orientation check. Choose the one the works for your situation.


Get the handle to the current device and hence the orientation.

[[UIDevice currentDevice] orientation]

Register for Orientation Change

Using the NSNotification Center add an observer to receive notification changes.

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil];

 Check Status Bar Orientation

In this approach check the orientation of the status bar

[UIApplication sharedApplication].statusBarOrientation[pb_builder]

Check Also

EKCalendar – That account does not allow calendars to be added or removed

Usecase When I am trying to create a new Calendar programmatically using the EventKit API …

Advertisment ad adsense adlogger