2

基本上,我想在分组表视图下创建一个按钮,例如 contacts.app 必须删除联系人。

我可以很好地创建按钮,我只是有点困惑如何决定把它放在哪里。

我以为我可以这样做:

CGRect bounds = [[self tableView] bounds];

然后基于此放置按钮。

但是,当访问 size.height 的边界时,我得到零!有没有一种动态的方法来检索我可能丢失的 tableView 的高度?

任何帮助是极大的赞赏。

富有的

4

3 回答 3

3

您可以创建按钮的大小,例如

CGRect buttonFrame = CGRectMake(0, 0, width, height);

使用该框架创建按钮,然后将按钮设置为tableView的页脚

myTableView.tableFooterView = myButton;
于 2009-09-21T21:10:28.017 回答
1

您可以通过实现以下方法尝试使用放置在该视图中的那些按钮制作自定义页脚视图:

- (CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
- (UIView *) tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section

这应该可以让您在您想要的部分下方的桌子上放置任意数量的按钮。

于 2009-09-21T20:58:17.673 回答
-1

您可以通过查看它的框架来获得 tablewViews 的高度

CGRect bounds= [[self tableView] frame]; 
float heigh= frame.size.height;
于 2009-09-21T20:55:06.010 回答