如何将UIPopoverPresentationController的高度设置为与UITableView相同 [英] How to set the height of a UIPopoverPresentationController to be the same as your UITableView

查看:113
本文介绍了如何将UIPopoverPresentationController的高度设置为与UITableView相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序上使用UIPopoverPresentationController在我的iPhone上显示一个弹出窗口(使用UIModalPresentationNone)。我希望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.


推荐答案

在课堂上,你在popover中添加一个代码:

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

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

这篇关于如何将UIPopoverPresentationController的高度设置为与UITableView相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆