【发布时间】:2014-03-28 09:22:22
【问题描述】:
我只想在TableView 的最后部分显示页脚文本。在TableView 我有很多来自API 的TableView 部分。但我只需要在tableView 的底部显示页脚消息部分怎么做?
(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
UIView *footer = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 540, 10)];
footer.backgroundColor = [UIColor clearColor];
UILabel *lbl = [[UILabel alloc]initWithFrame:footer.frame];
lbl.backgroundColor = [UIColor clearColor];
lbl.text = @"Your Text";
lbl.textAlignment = NSTextAlignmentCenter;
[footer addSubview:lbl];
return footer;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 10.0;
}
目前我使用此代码。这显示在所有部分底部。我只需要显示在最后一个 tableview 部分的底部。
【问题讨论】:
-
给
Tableview本身添加页脚怎么样。 -
我需要在最后一段显示一些文字
-
我正在使用Section tableview,您能告诉我如何在tableView 本身中实现吗?
-
@Rey_mysterio 如果你想要页脚视图到 tableview,请查看我的答案。
标签: ios ios5 tableview uitableview