【问题标题】:Remove Separator from Grouped UItableview从分组的 UItableview 中删除分隔符
【发布时间】:2017-07-26 09:06:41
【问题描述】:

我正在使用 UITableView 样式 分组 分隔符

当表格视图加载时,我看到单元格之间的距离很小。

当滚动时它会消失

需要摆脱那条线。我错过了什么。

【问题讨论】:

  • 你在用模拟器吗?
  • 这不是推荐的修复方法,但您可以将表格视图或分隔符的背景颜色设置为白色
  • @AbdulRehmanWarraich 我在所有设备中都遇到了这个问题

标签: ios objective-c iphone uitableview


【解决方案1】:

使用它,它会帮助你。

把这个写在你的 viewDidLoad 中

 tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];

并为 UITableView 编写此方法

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{

      if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {
          [tableView setSeparatorInset:UIEdgeInsetsZero];
      }

      if ([tableView respondsToSelector:@selector(setLayoutMargins:)]) {
          [tableView setLayoutMargins:UIEdgeInsetsZero];
      }

      if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
          [cell setLayoutMargins:UIEdgeInsetsZero];
      }
  }

【讨论】:

  • 嗨 Parvendra Singh,它对我没有帮助
【解决方案2】:

谢谢大家,

已通过将视图的底部约束设置为 -1 并取消选中 UITableViewCell 及其内容视图的剪辑到边界来解决此问题。

【讨论】:

    猜你喜欢
    • 2012-01-11
    • 2015-05-14
    • 2013-03-05
    • 1970-01-01
    • 2017-03-12
    • 2017-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多