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 ,reloadRowsAtIndexPaths 时有部分 Cell 的控件没有更新约束,将 Cell 上滑出tableView后可以正常显示 #304

Open AppleDP opened 5 years ago

AppleDP commented 5 years ago

Cell 里控件的约束添加
powerSwitch .sd_layout .rightSpaceToView(self, 15) .centerYEqualToView(self);

broadcastBtn
.sd_layout
.leftSpaceToView(self, 0)
.topSpaceToView(self, 0)
.bottomSpaceToView(self, 0)
.autoWidthRatio(1.);

broadcastBtn.imageView
.sd_layout
.spaceToSuperView(UIEdgeInsetsMake(8, 8, 8, 8));

titleLab
.sd_layout
.topSpaceToView(self, 5)
.leftSpaceToView(broadcastBtn, 5)
.rightSpaceToView(powerSwitch, 0)
.autoHeightRatio(0);

detailTitleLab
.sd_layout
.leftEqualToView(titleLab)
.topSpaceToView(titleLab, 5)
.rightEqualToView(titleLab)
.autoHeightRatio(0);

对控件赋值顺序 cell.power = YES; // powerSwitch cell.broadcastEnable = YES; // broadcastBtn cell.title = @"888"; // titleLab cell.detailTitle = @"188 5288 8888"; // detailTitleLab

在每一次设置完titleLab的值后,都会调用 [titleLab updateLayout],但是有部分 Cell 里 titleLab.frame 的 width 和 height 都为 0

zhangle520 commented 4 years ago

我也是,这个问题怎么解决

AppleDP commented 4 years ago

更新一下库就可以了

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: zhangle520 <notifications@github.com> 发送时间: 2020年7月8日 11:57 收件人: gsdios/SDAutoLayout <SDAutoLayout@noreply.github.com> 抄送: AppleDP <1263894417@qq.com>, Author <author@noreply.github.com> 主题: 回复:[gsdios/SDAutoLayout] 自定义 tableViewCell ,reloadRowsAtIndexPaths 时有部分 Cell 的控件没有更新约束,将 Cell 上滑出tableView后可以正常显示 (#304)

我也是,这个问题怎么解决

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.