Wednesday, 21 August 2013

Shift frame inside UIPopoverController

Shift frame inside UIPopoverController

My universal app uses NIBs for its settings screens. I'd like to use the
same NIBs for both iPhone and iPad.
Thus on iPad, I use a UIPopoverController and for settings, simply display
the iPhone-sized NIBs. The popover is sized 320x460 points.
This causes a problem, because the iPhone version draws a number of things
above the status bar programmatically, and for the iPad version this is
not necessary. Current situation on iPad:

As you can see, there's a big empty space above the "Settings" title. Thus
what I want, is to shift the view controller up about 20 points, inside
the popover.
I've tried setting the frame inside the viewcontroller itself, but that
doesn't work:
- (void)viewWillLayoutSubviews
{
// shift it up
CGRect frame = self.view.frame;
frame.origin.y = -20;
[self.view setFrame:frame];
}
This has no effect, the popover overrides this resizing. How to go about?

No comments:

Post a Comment