【问题标题】:UITableViewCell separator lines appearing during editingstyle编辑样式期间出现的 UITableViewCell 分隔线
【发布时间】:2014-02-18 07:11:30
【问题描述】:

带有 cell.backgroundView 和 self.webSiteTableView.separatorStyle = UITableViewCellSeparatorStyleNone 的 UITableViewCell ,当我进入 editorStyle 时,该行出现在带有红色背景的 DELETE 按钮下方。单元格之间没有线,当我进入编辑样式时,只有部分显示在按钮下..

我几乎尝试了所有方法:

[self.webSiteTableView setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 0)];
self.webSiteTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[[UITableView appearance]setSeparatorInset:UIEdgeInsetsZero];
self.webSiteTableView.backgroundColor = [UIColor clearColor];

cell.contentView.backgroundColor = [UIColor clearColor];
cell.backgroundColor = [UIColor clearColor];
[cell setBackgroundColor:[UIColor clearColor]];

它只是没有工作......这条线仍然存在......有什么办法让它消失吗?谢谢!

更新:我试过 self.webSiteTableView.backgroundColor = [UIColor redColor];结果分隔线确实消失了..问题是DELETE按钮的高度小于单元格的高度...我该如何解决?我怎样才能使按钮更大? ..

【问题讨论】:

  • 您可以像这样添加自定义分隔符stackoverflow.com/a/21249030/1294448
  • [[UITableView appearance]setSeparatorInset:UIEdgeInsetsZero];不使用分隔符时这段代码有什么用。
  • 我试过 self.webSiteTableView.backgroundColor = [UIColor redColor];结果分隔线确实消失了..问题是DELETE按钮的高度小于单元格的高度...我该如何解决?我怎样才能使按钮更大? ..

标签: ios objective-c uitableview


【解决方案1】:

交换两个语句的顺序。先设置颜色,再设置插图:

self.tableView.separatorColor = [UIColor clearColor];
self.tableView.separatorInset = UIEdgeInsetsZero;

【讨论】:

  • 我试过 self.webSiteTableView.backgroundColor = [UIColor redColor];结果分隔线确实消失了..问题是DELETE按钮的高度小于单元格的高度...我该如何解决?我怎样才能使按钮更大? ..
【解决方案2】:

我遇到了同样的问题,试图隐藏分隔符。 我使用下面的委托方法来解决它。

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    // This will create a "invisible" footer
    return 0.01f;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    return [UIView new];

    // If you are not using ARC:
    // return [[UIView new] autorelease];
}

【讨论】:

  • 我试过 self.webSiteTableView.backgroundColor = [UIColor redColor];结果分隔线确实消失了..问题是DELETE按钮的高度小于单元格的高度...我该如何解决?我怎样才能使按钮更大? ..
  • 是的,你可以这样做。如果您搜索过,您可以轻松找到它。任何方式,请通过此链接它会对您有所帮助:stackoverflow.com/questions/19281834/…
猜你喜欢
  • 2011-11-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-03
  • 1970-01-01
相关资源
最近更新 更多