gsdios / SDAutoLayout

One line of code to implement automatic layout. 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于做最简单易用的AutoLayout库。The most easy way for autoLayout. Based on runtime.
MIT License
5.9k stars 1.28k forks source link

tableViewCell自适应高度方法能否优化? #212

Open alkayoun opened 7 years ago

alkayoun commented 7 years ago

我看Demo中:

// 获取cell高度调用方法: return [self.tableView cellHeightForIndexPath:indexPath model:model keyPath:@"model" cellClass:[DemoVC9Cell class] contentViewWidth:cellContentViewWith];

会使用kvo调用cell内的setModel方法,将model给cell.model赋值;

然后cell内的setModel方法会执行cell内数据赋值并在最后确定bottomView后, 使用[self setupAutoHeightWithBottomView:bottomView bottomMargin:15];方法,自适应cell高度。

 小弟不才,习惯使用cellHelper中间人来获取model 和 对应cell,由cellHelper来处理model里的数据,再对cell赋值。(并对cell内的一些操作进行存值)
小弟尽量想让view层和model层相互解耦。

最后请问能否优化相关方法,如有回复小弟林感涕零不知所言~~~~
alkayoun commented 7 years ago

使用SD另外一个性能较低的方法解决了先