Getting Device Orientation in iOS

Mr.Javed Multani
1 min readOct 5, 2020
UIDevice *deviceInfo = [UIDevice currentDevice];
int d = deviceInfo.orientation;

deviceInfo.orientation returns an UIDeviceOrientation value which is shown as below:

UIDeviceOrientationUnknown 0
UIDeviceOrientationPortrait 1
UIDeviceOrientationPortraitUpsideDown 2
UIDeviceOrientationLandscapeLeft 3
UIDeviceOrientationLandscapeRight 4
UIDeviceOrientationFaceUp 5
UIDeviceOrientationFaceDown 6

Listening for device orientation changes in a View Controller:

- (void)viewWillAppear:(BOOL)animated…

--

--

Mr.Javed Multani

Software Engineer | Certified ScrumMaster® (CSM) | UX Researcher | Youtuber | Tech Writer