ios - 选择部分中的最后一行后显示的分隔线

标签 ios uitableview ios7

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

我有简单样式的 UITableViews。该部分的最后一行没有分隔符,它只是混合到部分标题中(顺便说一句,默认使用)。检查最后一行的高度,Apple 似乎将其放大 1px 以从单元格中删除分隔符高度。问题是当我选择该行但拖走时,分隔线出现并且永远不会消失。如果我返回 View 并返回,它默认为关闭。

我在所有表格 View 、普通单元格和自定义单元格中都看到了这一点。当我取消选择时,我该怎么做才能确保最后一个分隔符不存在?仅适用于 iOS 7。运行当前版本,没有测试版。

最佳答案

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

- (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];
}

关于ios - 选择部分中的最后一行后显示的分隔线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21239279/

相关文章:

iOS 缺少 grant_type

ios - 如何将 UITableView 中的单元格颜色设置为透明?

ios - UIAlertView 事件

ios - 如何强制-drawViewHierarchyInRect :afterScreenUpdates: to take snapshots at @2x resolution?

ios - 各种UIgesture是否优先于touchbagan?

ios - 更改单元格中的数据后,UITableView 中的自定义单元格不会正确重新加载

ios - 我应该在哪里准备数据?在 awakeFromNib、viewDidLoad 或其他东西中

ios - 使用 Storyboard 以编程方式设置初始 View Controller

ios - 如何为不同的屏幕尺寸设置不同的自动布局约束

ios - 获取文档目录中特定文件夹的内容