Reputation: 1875
I've created a custom view controller that is initialized using a NIB. In the NIB, I've given the view outlet a specific size. When I create a new popover controller and initialize it with my custom view controller, I expected the popover controller's content area to be the size of the view I specified in my NIB, but it seems to be ignoring this size and using the default popover controller size instead.
I know that I can specify the popover's content area size in code, but shouldn't I be able to do this in interface builder?
In my custom view controller's viewDidAppear method, I'm printing out the view's bound's width and height, but strangely they are both 0. What am I doing wrong?
Upvotes: 2
Views: 1657
Reputation: 1677
Yes you can do it from a storyboard by:
Caveat: I have 2 popovers I am working on at the moment - the first one behaves itself very well (even got it center'd on the screen using insets), the second one I have just spent half a day wondering why it's the right width and the wrong height .... grrrr, if you don't set an arrow direction weird stuff happens.
Upvotes: 1
Reputation: 535202
You can't specify a UIViewController's contentSizeForViewInPopover
in the nib. I like to set it in viewDidLoad
.
Your "printing out" code might just be wrong. It's easy to get tripped up by the fine points of calling NSLog. Try it this way:
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
NSLog(@"%@", NSStringFromCGSize(self.view.bounds.size));
}
If that doesn't work, something else is going on.
Upvotes: 3