以编程方式更改 UITableView 的高度 [英] Change height of UITableView programmatically

查看:30
本文介绍了以编程方式更改 UITableView 的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UITableView,我想根据其中包含的单元格数量以编程方式更改其高度.

I have a UITableView and I'd like to change its height programmatically depending on the number of cells contained in it.

你能帮我吗?

推荐答案

你可以观察tableView.contentSize的变化并将值绑定到frame,记住你可能会遇到内存问题,因为表视图不会回收单元格

You can observe tableView.contentSize changes and bind the value to the frame, keep in mind you might run into memory issues since table view won't recycle cells

这篇关于以编程方式更改 UITableView 的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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