objective-c - iOS的constraints约束一个警告问题
迷茫
迷茫 2017-05-02 09:28:15
0
1
479

1、说明:我自定义一个View,View和里面子控件用Masonry布局。使用时,是先创建这个[[View alloc]init],然后加入到scrollView中。获得数据后,计算大小,然后才设置View的frame。

2、问题:图片中红色2句是问题的核心, "<NSAutoresizingMaskLayoutConstraint:0x14120da50 GoodsDetailPlanView:0x140da0e50.width == 0>" <MASLayoutConstraint:0x140da7100 UILabel:0x140da4bb0.width == 100> 冲突。意思是NSAutoresizingMaskLayoutConstraint约束设置View宽度为0,但我Masonry布局子控件宽度设置为100。

3、解决:这个问题怎么解决呢?NSAutoresizingMaskLayoutConstraint我不太了解,设置为NO后,控件就不见了。

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(1)
过去多啦不再A梦

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!