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?
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.