How To Dynamically change the contentSize of UIPopoverController?

后端 未结 8 599
执念已碎
执念已碎 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:04

    For iOS 7 or above.

    - (CGSize)preferredContentSize {
        return CGSizeMake(320, 550);
    }
    

    If you are a child of a container, re-direct the content size to yourself. E.g. In a UINavigationController subclass:

    - (CGSize)preferredContentSize {
        return self.topViewController.preferredContentSize;
    }
    

提交回复
热议问题