美文网首页
UITableViewCell 点击弹出 UIAlertCont

UITableViewCell 点击弹出 UIAlertCont

作者: 古子林 | 来源:发表于2017-11-10 09:38 被阅读28次
    目前遇到这种情况是在 cell 的选择状态 selectionStyle 设为 UITableViewCellSelectionStyleNone 时出现,而用 UIAlertView 是不会有这样的 bug 的(这应该是 UIAlertController 的一个 bug)。但 UIAlertView 在 9.0 之后就被废弃了,不推荐再用。所以今天我就记录一下 UIAlertController 如何处理卡顿问题。

    方法一:

    cell 的选中样式 selectionStyle 不要设为 UITableViewCellSelectionStyleNone。

    方法二:

    如果界面的确不需要选中样式,那么可以采取如下处理方式
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    然后在 didSelectRowAtIndexPath 方法中取消选中状态
    -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    // 处理点击 cell 的后续逻辑
    }

    这样就解决了弹出卡顿的 bug。

    相关文章

      网友评论

          本文标题:UITableViewCell 点击弹出 UIAlertCont

          本文链接:https://www.haomeiwen.com/subject/qpwvmxtx.html