美文网首页
表格 cell的子控件莫名调整高度

表格 cell的子控件莫名调整高度

作者: 似奔跑的野马 | 来源:发表于2017-09-15 10:52 被阅读0次

问题:�UITableView或者UICollectionView的子控件,设置了autoresizingMask,有时高度不对,手动设置frame,子控件有时高度不对,变矮了。

 self.videoLayerContainerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

原因分析:

  • 手写frame和自动布局交叉使用造成布局问题,调用栈出现,如下
    [UIView(Geometry) _applyAutoresizingMaskWithOldSuperviewSize:] ()

解决方案:

 - 禁用掉自动布局,采用手动布局。
 self.videoLayerContainerView.autoresizingMask = UIViewAutoresizingFlexibleNone;
图片图片

相关文章

网友评论

      本文标题:表格 cell的子控件莫名调整高度

      本文链接:https://www.haomeiwen.com/subject/strssxtx.html