SDAutoLayout icon indicating copy to clipboard operation
SDAutoLayout copied to clipboard

自定义 tableViewCell ,reloadRowsAtIndexPaths 时有部分 Cell 的控件没有更新约束,将 Cell 上滑出tableView后可以正常显示

Open AppleDP opened this issue 7 years ago • 2 comments

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

AppleDP avatar Dec 27 '18 07:12 AppleDP

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

zhangle520 avatar Jul 08 '20 03:07 zhangle520

更新一下库就可以了

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: zhangle520 <[email protected]> 发送时间: 2020年7月8日 11:57 收件人: gsdios/SDAutoLayout <[email protected]> 抄送: AppleDP <[email protected]>, Author <[email protected]> 主题: 回复:[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.

AppleDP avatar Jul 08 '20 04:07 AppleDP