Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the height of a UIPopoverPresentationController to be the same as your UITableView

I'm using a UIPopoverPresentationController on my app to show a popover on my iPhone (with UIModalPresentationNone). I want the size to be dynamic with the height of the UITableView, but i can't find out how to do that. The size of the popover is the same on every device.

enter image description hereenter image description here

like image 614
lennartk Avatar asked Oct 20 '22 22:10

lennartk


1 Answers

In the class, that you present in popover add a code:

- (void)viewDidLayoutSubviews {
    self.preferredContentSize = CGSizeMake(320, tableView.contentSize.height);
}
like image 112
Igor Avatar answered Nov 01 '22 14:11

Igor