美文网首页
关于UITableView的经验教训

关于UITableView的经验教训

作者: 健尐 | 来源:发表于2016-08-08 15:16 被阅读35次

    改UITableViewCell的选中状态

    1. 以为设置UITableViewCell的selected属性为True就等于选中
    2. 需要用-selectRowAtIndexPath:animated:scrollPosition:方法才能达到选中效果
    

    -selectRowAtIndexPath:animated:scrollPosition:方法(选中行)

    1. 会令UITableViewCell为选中状态
    2. 不会调用UITableViewDelegate的-(void)tableView:didSelectRowAtIndexPath:方法
    

    -deselectRowAtIndexPath:animated:方法(未选中行)

    1. 会令UITableViewCell为未选中状态
    2. 不会调用UITableViewDelegate的-(void)tableView:didDeselectRowAtIndexPath:方法
    

    -dequeueReusableCellWithIdentifier:(Cell重用)

    1. 会在自动释放池获取UITableViewCell,样式是修改后的,不是init样式
    2. 需要重新赋值修改样式
    

    -dequeueReusableHeaderFooterViewWithIdentifier:(分组头尾部视图重用)

    1. 受-reloadData方法影响,失去重用功能,要到iOS9版本苹果才更正
    2. 貌似在iOS9以下的作用不大,兼容iOS9以下建议不用
    

    相关文章

      网友评论

          本文标题:关于UITableView的经验教训

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