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

计算cell高度 反复调用sd_layoutSubviewsHandle 每次下拉刷新后 阻塞主线程 时间一次比一次长 #308

Open insurgentZhao opened 5 years ago

insurgentZhao commented 5 years ago

cell中有3个view 需要自适应高度 cell根据这三个view再自适应高度 类似demo中朋友圈

自定义view参考demo在内部实现了高度自适应 使用此方法实现view的高度自适应 [self.contentContainerView setUpContentArrayWithContentArray:model.contentArr]; self.imageContainer.imageUrlStr = model.poster; [self.docContainer setUpDocArrayWithDocArray:model.docsArr]; 使用下面三个方法 实现对应父视图的自适应高度 [self.desContainView setupAutoHeightWithBottomView:self.docContainer bottomMargin:15]; [self.containView setupAutoHeightWithBottomView:self.desContainView bottomMargin:50]; [self setupAutoHeightWithBottomView:self.containView bottomMargin:15]; desContainView的子view为 contentContainerView imageContainer docContainer containView的子view为 desContainView cell根据containView自适应高度 cell自使用高度代码为 ` return [self.tableView cellHeightForIndexPath:indexPath model:model keyPath:@"model" cellClass:currentClass contentViewWidth:[self cellContentViewWith]];

` 界面布局如下图 请问是什么原因造成的 谢谢 img_2108