CustomeCell.m
-(voID)layoutSubvIEws{ [super layoutSubvIEws]; _con_vIEw_wIDth.constant = _lbl_property.frame.size.wIDth; if(!_btn_imageCount.isHIDden) _con_vIEw_wIDth.constant = _lbl_property.frame.size.wIDth + _btn_imageCount.frame.size.wIDth; NSLog(@"%@",NsstringFromCGRect(_vIEw_lbl_btn.frame)); [_vIEw_lbl_btn updateConstraintsIfNeeded]; NSLog(@"%@",NsstringFromCGRect(_vIEw_lbl_btn.frame));}
问题
只有在滚动时重新加载行时,约束才起作用
-(voID)layoutSubvIEws{ [super layoutSubvIEws]; _con_vIEw_wIDth.constant = _lbl_property.frame.size.wIDth; if(!_btn_imageCount.isHIDden) _con_vIEw_wIDth.constant = _lbl_property.frame.size.wIDth + _btn_imageCount.frame.size.wIDth; NSLog(@"%@",NsstringFromCGRect(_vIEw_lbl_btn.frame)); [_vIEw_lbl_btn layoutIfNeeded]; NSLog(@"%@",NsstringFromCGRect(_vIEw_lbl_btn.frame));}
编辑:如果您在自定义单元格类中执行此 *** 作,则需要在索引路径的行中为单元格添加一行.
- (UItableVIEwCell *)tableVIEw:(UItableVIEw *)tableVIEw cellForRowAtIndexPath:(NSIndexPath *)indexPath{ UItableVIEwCell *cell = [tableVIEw dequeueReusableCellWithIDentifIEr:@"Cell" forIndexPath:indexPath]; //[cell layoutIfNeeded]; [cell layoutSubvIEws]; return cell;}总结
以上是内存溢出为你收集整理的ios – 更新单元子视图的约束全部内容,希望文章能够帮你解决ios – 更新单元子视图的约束所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)