Ferdinand Rios
Ferdinand Rios

Reputation: 1192

iOS 8 popover width = 0 on iPad in Portrait mode only

I have a very simple UI design set up in IB where a segmented control calls a segue to display a popover on the iPad. The segue is set up as "Present as popover" and has an anchor. The presented view controller is a table embedded in a navigation controller.

In my prepareForSegue code, I don't do much but set the title.

The presented view controller has a preferredContentSize method defined as

- (CGSize)preferredContentSize {
CGSize size;

if (self.traitCollection.userInterfaceIdiom == UIUserInterfaceIdiomPad) {
    size = CGSizeMake(600, 600);
} else {
    size = CGSizeMake(320, 480);
}
return size;

}

This works great in iPad landscape and iPhone in both portrait and landscape (as full screen). But on iPad in portrait mode the popover rectangle is Left: 0.000000, Top: 13.000000, Width: 0.000000, Height: 31.000000. With a width of 0.0000 obviously it is not displayed.

If I display the popover in landscape mode on the iPad then rotate it to portrait, the popover remains displayed properly.

So what am I doing wrong that the frame of the popover is getting reset in portrait mode to a width of zero?

Upvotes: 0

Views: 167

Answers (1)

Joey
Joey

Reputation: 173

Unfortunately I got the exact same problem as you described.

  • iPad landscape is ok
  • iPod/iPhone is both ok, either direction

Displaying it in iPad landscape and rotate to portrait shows the popover correctly.

The only difference I got with you is that my popover gives me a frame of {{0,0},{0, 13}} at the "viewDidAppear" method.

Upvotes: 0

Related Questions