美文网首页
tableView创建Cell,两种方法的区别,随手记

tableView创建Cell,两种方法的区别,随手记

作者: Z_JaDe | 来源:发表于2016-01-02 13:00 被阅读149次

dequeueReusableCellWithIdentifier:forIndexPath:方法会调用一次tableView:heightForRowAtIndexPath:方法,但是dequeueReusableCellWithIdentifier:就不会调用,由此可见用dequeueReusableCellWithIdentifier:forIndexPath:初始化出来的Cell的高度是根据tableView:heightForRowAtIndexPath:得来的。

无论是用哪一种初始化Cell,之后都会调用一次tableView:heightForRowAtIndexPath:

另外reloadData会调用一遍tableView:heightForRowAtIndexPath:,然后tableViewcontentSize就更新了

相关文章

网友评论

      本文标题:tableView创建Cell,两种方法的区别,随手记

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