美文网首页
取消tableViewCell 的选中状态

取消tableViewCell 的选中状态

作者: LJ的ios开发 | 来源:发表于2016-02-29 09:43 被阅读2850次

    - (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath {

    //其他代码

    [tableView deselectRowAtIndexPath:indexPath animated:YES];// 取消选中

    //其他代码

    }

    - (void)deselectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated

    方法的官方文档描述:Deselects a given row identified by index path, with an option to animate the deselection.

    Calling this method does not cause the delegate to receive a tableView:willDeselectRowAtIndexPath: or tableView:didDeselectRowAtIndexPath: message, nor does it send UITableViewSelectionDidChangeNotification notifications to observers.

    Calling this method does not cause any scrolling to the deselected row.

    中文的意思就是:根据 indexPath 以动画的形式取消选中。调用此方法不会造成委托接受tableView:willDeselectRowAtIndexPath和tableView:didDeselectRowAtIndexPath:消息;不给UITableViewSelectionDidChangeNotification通知观察者;调用此方法不会产生任何滚动到取消行。

    相关文章

      网友评论

          本文标题:取消tableViewCell 的选中状态

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