【问题标题】:Show amount of cell at the end of the TableView在 TableView 末尾显示单元格数量
【发布时间】:2016-02-26 17:26:39
【问题描述】:

我在 Table View Controller 中有联系人列表。如何确保在表格末尾显示联系人(或单元格)的数量??? 我的单元格列表中有字典

【问题讨论】:

  • 您是否尝试在表格视图中添加页脚并在页脚中显示行数?另外,如果您不希望页脚浮动,请尝试使用分组单元格。
  • 看看下面的答案。

标签: uitableview dictionary nsdictionary plist tableviewcell


【解决方案1】:

通过下面的 UITableViewDelegate 方法尝试使用表格视图页脚:

- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section

返回一个带有表格行数的标签。如果您不希望页脚浮动,请使用 UITableViewStyleGrouped

查看this了解更多详情

【讨论】:

  • {- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section~} 这个方法不合适(或者我不能)。因为我只想创建页脚并在最后
  • 我添加了这个:UIView *fview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 375, 105)]; fview.backgroundColor =[UIColor colorWithPatternImage:[UIImage imageNamed:@"footer.png"]]; self.tableView.tableFooterView = fview;
  • 您当然可以使用委托方法为您的表格创建唯一的页脚。此外,分组表将在最后显示标题,非浮动,如答案中所述。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多