开发者

When displaying a UITableView in a UIPopoverViewController, how do you automatically resize the height?

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 i开发者_Python百科s there a better way? I'm hoping not to have to hard code the height. (A hardcoded max height would be fine, though.)


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:

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜