How do I resize the UITableView#39;s height dynamically?(如何动态调整 UITableView 的高度?)
问题描述
在我的应用程序中,我想在它处于编辑模式时调整表格视图的高度,而不是在它不处于编辑模式时(以便为表格视图下方的编辑控件腾出空间)
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 的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何动态调整 UITableView 的高度?


- Android - 拆分 Drawable 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01