美文网首页
UITableView不定高Cell优化

UITableView不定高Cell优化

作者: ISwiftUI | 来源:发表于2017-03-02 16:27 被阅读109次
    0.AutoLayout + AutomaticDimension

    注意:ios 8及以上才可以使用,这种实现方案用起来简单,不过UI流畅度方面不太理想。当TableView快速滑动时,就会出现掉帧

    1.AutoLayout + CountCellHeight
    2.Frame + CountCellHeight

    直接使用Frame来布局,这样就减少了由AutoLayout转换到FrameLayout的时间。
    总结:在不使用第三方的情况下,以上三种方式,第2种方式是最好的选择,其它几种会严重掉帧

    3.YYKit + CountCellHeight

    虽然YYKit做了一定的优化,但是还是有掉帧的现象
    注意使用的是YYKit里的控件(YYLable YYTextView)

    4.AsyncDisplayKit+ CountCellHeight
    @property (strong, nonatomic) ASImageNode *headerImageNode;
    @property (strong, nonatomic) ASTextNode *titleTextNode;
    @property (strong, nonatomic) ASTextNode *timeTextNode;
    @property (strong, nonatomic) ASTextNode *contentTextNode;
    

    第4种是最好的方式,但是过分的依赖facebook的第三方,迁移起来也比较的麻烦

    5.高度缓存Cell的高度

    使用百度开源的框架
    UITableView-FDTemplateLayoutCell

    相关文章

      网友评论

          本文标题:UITableView不定高Cell优化

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