1、说明:我自定义一个View,View和里面子控件用Masonry布局。使用时,是先创建这个[[View alloc]init],然后加入到scrollView中。获得数据后,计算大小,然后才设置View的frame。
2、问题:图片中红色2句是问题的核心,"
和
冲突。意思是NSAutoresizingMaskLayoutConstraint约束设置View宽度为0,但我Masonry布局子控件宽度设置为100。
3、解决:这个问题怎么解决呢?NSAutoresizingMaskLayoutConstraint我不太了解,设置为NO后,控件就不见了。
Thanks for the invitation = = From the error message, we can’t tell what’s going on. One guess is that the parent view didn’t add autoLayout. As a result, the width is 0, and the width of the child view is 100. It can’t survive.
NSAutoresizingMaskLayoutConstraint This is the constraint translated from autoResizingMask. If you don’t want it, you can change an attribute
translatesAutoresizingMaskIntoConstraints
(it seems to be called this) to NO.