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

I use the UIPopoverPresentationController in my application to show a popover on my iPhone (with UIModalPresentationNone). I want the size to be dynamic with the height of a UITableView, but I cannot find out how to do this. The size of the popover is the same on every device.

enter image description hereenter image description here

+5
source share
1 answer

In the class you represent in popover, add the code:

- (void)viewDidLayoutSubviews { self.preferredContentSize = CGSizeMake(320, tableView.contentSize.height); } 
+1
source

Source: https://habr.com/ru/post/1207398/


All Articles