【发布时间】:2014-07-24 21:49:58
【问题描述】:
我正在尝试在表格视图的底部添加页脚。这是一个简单风格的 tableView,只有 1 个部分和 1 个动态原型单元格。我使用这种方法来创建页脚:
- (NSString *) tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section{
if (section == 0){
return @"Section 1 Footer";
}
return nil;
}
结果是页脚在正确的位置,但看起来像页眉(灰色背景加粗字体)
如果我将表格样式切换为“分组”,它似乎可以正常工作,但我不想要这个。关于如何解决它的任何想法?谢谢!
【问题讨论】:
-
我没有此表的标题。但是即使我添加一个,我仍然会遇到这个问题。
-
您忘记为页脚创建视图: UITableViewHeaderFooterView *sectionFooter = [self.tableview footerViewForSection:0]; [sectionFooter.contentView addSubview:self.myFooterView];也不要忘记实现 -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
-
如果我已经在使用“titleForFooterInSection”,是否需要“viewForFooterInSection”?
标签: ios uitableview footer