美文网首页
estimatedRowHeight-行的预估高度

estimatedRowHeight-行的预估高度

作者: js_huh | 来源:发表于2020-04-04 21:41 被阅读0次
    • estimatedRowHeight
      • UITableView的属性
      • 表格视图中,预估cell高度的属性.
    • 预估高度,有什么好处?
      • 有了预估高度后,就会在用到时再调用heightForRowAtIndexPath方法,
        不会,程序启动后,就调用N次heightForRowAtIndexPath方法,进而消耗大量性能.
        (备注: "N次"指的是,如有1W个cell,则一次性调用1W次heightForRowAtIndexPath方法)
      • heightForRowAtIndexPath 简述
        heightForRowAtIndexPath 优化
      • 在程序加载时,设置cell的预估高度.
        - (void)viewDidLoad {
        [super viewDidLoad];
        // 告诉tableView所有cell的估算高度
        self.tableView.estimatedRowHeight = 200;
        }
        

    相关文章

      网友评论

          本文标题:estimatedRowHeight-行的预估高度

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