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

崩溃,在[self.rightTableView cellHeightForIndexPath: model: keyPath: cellClass: contentViewWidth:]崩溃 #291

Closed yangxiutao closed 5 years ago

yangxiutao commented 6 years ago

在[self.rightTableView cellHeightForIndexPath:indexPath model:model keyPath:@"model" cellClass:[SDProvinceConvenienceHomeRightCell class] contentViewWidth:(CGRectGetWidth(self.view.frame) - 30)]中崩溃 image

liujunliuhong commented 6 years ago

很多时候有可能并不是框架本身的问题,而是代码问题。检查一下代码,可能是你代码哪儿出问题了

Just013 commented 5 years ago

在[self.rightTableView cellHeightForIndexPath:indexPath model:model keyPath:@"model" cellClass:[SDProvinceConvenienceHomeRightCell class] contentViewWidth:(CGRectGetWidth(self.view.frame) - 30)]中崩溃 image

你看一下这个方法的注释,kvc对应cell里模型的名称。 不一定是作者的model,你写的是什么这里才是什么。

earlyfly commented 2 years ago

请问问题解决了吗?当tableview是分组的时候,一个model作为一个section(包含多个row)的数据源的情况时,代码真会崩溃在UITableView+SDAutoTableViewCellHeight.m中的267行代码:[self.modelCell setValue:model forKey:keyPath];

使用的SDAutoLayout的版本为2.2.1

使用[self cellHeightForIndexPath:indexPath cellContentViewWidth:[UIScreen mainScreen].bounds.size.width];是没问题的,但是作者说这个方法在cell数超过100时会影响性能。求解