wolverine
wolverine

Reputation: 3027

How can I programmatically know which interface orientaton I am in when the application loads?

Using some of the methods, I am able to check the orientations to which I am rotating my device. But how can I know the orientation in which I am in when the app is loaded? I want to write the code to rearrange the views in the viewDidLoad method by checking the way my orientation is in?

Upvotes: 0

Views: 276

Answers (2)

Rob
Rob

Reputation: 520

You could also use something similar to below in the ViewDidLoad/ViewWillAppear methods.

if(UIInterfaceOrientationIsLandscape(self.interfaceOrientation)){
}

Upvotes: 0

Mihir Mehta
Mihir Mehta

Reputation: 13843

UIDeviceOrientation myOrientation = [[UIDevice currentDevice] orientation];

Upvotes: 2

Related Questions