Centering subview's X in autolayout throws “not prepared for the constraint”

前端 未结 8 1254
予麋鹿
予麋鹿 2020-11-30 02:09

I have a custom UIView subclass which is being initialized via a nib.

In -awakeFromNib, I\'m creating a subview and attempting to center it in its super

8条回答
  •  既然无缘
    2020-11-30 02:58

    Additional Tips:

    I have a newly developed App which running fine on iOS7 but get error on iOS8 "The view hierarchy is not prepared for the constraint".

    Read some other post said that the (sub)views need to be added before create constraints. I did that but still got the error.

    Then I figured out that I should create constraints under -(void)viewDidAppear instead of viewDidLoad

提交回复
热议问题