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