How To Dynamically change the contentSize of UIPopoverController?

后端 未结 8 585
执念已碎
执念已碎 2020-12-14 16:35

I have a UIViewController that contains a UITableView. This UIViewController is being displayed in a UIPopoverController.

8条回答
  •  星月不相逢
    2020-12-14 17:07

    This should do the trick

    override func viewWillLayoutSubviews() {
      super.viewWillLayoutSubviews()
    
      self.preferredContentSize = CGSizeMake(0, self.tableView.contentSize.height)}
    

提交回复
热议问题