如何动态调整UITableView的高度? [英] How do I resize the UITableView's height dynamically?

查看:128
本文介绍了如何动态调整UITableView的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我想调整tableview的高度,当它处于编辑模式时,而不是(当为了在表格视图下方为编辑控件腾出空间时)

In my app, I would like to resize the tableview's height when it's in edit mode vs when it's not (in order to make room for editing controls below the table view)

应该怎么做?

推荐答案

我发现操纵bounds属性可能会导致一些意想不到的行为你有另一个视图内的浮动表。有时,当增加高度时,表格会向上扩展,即使原点仍为0,0。

I found that manipulating the "bounds" property can result in some unexpected behavior when you have a floating table inside another view. Sometimes the table expands upward when increasing the height, even though the origin is still 0,0.

frame属性可能更有效:

The "frame" property might be more effective:

CGRect tvframe = [tableView frame];
[tableView setFrame:CGRectMake(tvframe.origin.x, 
                                tvframe.origin.y, 
                                tvframe.size.width, 
                                tvframe.size.height + 20)];

这篇关于如何动态调整UITableView的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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