在选择节中的最后一行后显示分隔线

时间:2014-01-20 16:32:22

标签: ios uitableview ios7

我在所有的UITableView中都看到了一种奇怪的行为。这开始让我疯狂。

我有简单风格的UITableViews。该部分的最后一行没有得到分隔符,它只是混合到节标题(顺便说一下默认用法)。检查最后一行的高度,看起来Apple正在增大1px以从单元格中移除分隔符高度。问题是当我选择行但拖动时,分隔线显示并且永远不会消失。如果我返回视图并返回,则默认为关闭。

我在所有的桌面视图,普通单元格和自定义单元格中看到了这一点。取消选择时,我该怎么做才能确保最后一个分隔符远离? iOS 7仅构建。运行当前版本,没有测试版。

2 个答案:

答案 0 :(得分:1)

对我来说,重新加载单元格有助于解决一些分隔线问题:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
    [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
}

- (void)tableView:(UITableView *)tableView didUnhighlightRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
}

答案 1 :(得分:0)

如果将故事板中tableView的样式从plain更改为分组,则不会出现此行为。它会在你的部分上面给你一个标题。要摆脱它,请执行此操作 -

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0.01f;
}
相关问题