Reputation: 9467
I'm presenting a UIPopoverViewController
with a UINavigationController
with a UITableViewController
inside of it. The tableview only has four rows, but the height of the popover is as big as the screen allows.
What is the proper way to limit the height of the popover? Do I need to set the tableview height (based on headers, footers, row heights) or is there a better way? I'm hoping not to have to hard code the height. (A hardcoded max height would be fine, though.)
Upvotes: 0
Views: 876
Reputation: 3400
viewDidAppear
self.contentSizeForViewInPopover = CGSizeMake(320, 400);
self.navigationController.contentSizeForViewInPopover = CGSizeMake(320, 400);
this way you set the size of the Popover.
The hight could be calculated with – tableView:heightForHeaderInSection:
and – tableView:heightForRowAtIndexPath:
Upvotes: 2