以编程方式更改UITableView的大小 [英] Changing the size of UITableView programmatically
问题描述
我正在尝试在我的服务器上显示mysql数据库中的数据。我正在将数据加载到表中。问题是,我不希望这些数据成为视图中的唯一内容。我希望该表与其他内容共享。理想情况下,我希望桌子能够随着它们的数量增长而扩展。因此,如果有3个单元格,我希望它能够适应所有3个单元格。如果有10个单元格,我希望它能够适应所有10个单元格。
I am trying to display data from a mysql database on my server. I am loading the data into a table. The problem is, I don't want this data to be the only thing on the view. I want the table to be shared with other content. Ideally, I would like the table to be able to grow and expand with how many cells their are. So if there are 3 cells, I would like it to grow to fit all 3. If there are 10, I would like it to grow to fit all 10.
它看起来Apple做了很多。我注意到的一个主要地方是他们的联系人,电话号码表的增长和缩小取决于有多少数字。
It looks like Apple does this a lot. A major place I notice it is in their contacts, the phone numbers table grows and shrinks depending on how many numbers there are.
我在网上搜索过但不能找到很多关于此的信息。任何人都可以帮忙吗?
I've searched online and can't find a lot of info on this. Can anyone help out?
谢谢
推荐答案
使用以下代号tableview大小决定其内容......
with bellow code your tableview size decide with its content...
tableView.frame = CGRectMake(tableView.frame.origin.x, tableView.frame.origin.y, tableView.frame.size.width, tableView.contentSize.height);
希望这有助于你...... :)
hope this help you... :)
这篇关于以编程方式更改UITableView的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!