Kenny Wyland
Kenny Wyland

Reputation: 21880

UIViewController in UIPopoverController always reports as being in Portrait mode

I've got a view controller in a UIPopoverController. I want to adjust the ui based on whether or not it is in portrait orientation.

No matter what orientation my iPad is in (physical device), self.interfaceOrientation always reports Portrait. I'm logging it in -viewWillAppear: and it's always Portrait.

Why?

Upvotes: 1

Views: 176

Answers (2)

edzio27
edzio27

Reputation: 4140

Use:

UIInterfaceOrientation deviceOrientation = [UIApplication sharedApplication].statusBarOrientation;

to recognize statusBar oriantation.

Upvotes: 2

rmaddy
rmaddy

Reputation: 318944

A view controller in a popover is always in portrait. The popover's orientation is always portrait no matter which way the device is held.

If you wish to do something different in the view controller based on the device's orientation, look at the UIApplication statusBarOrientation.

Think of the popover as following gravity. It always points down.

Upvotes: 2

Related Questions