I created a custom UIView based on a xib file and added some UIVIews with constraints.
In my View Controller I added a UIView and set the class to my custom view. So far so good. My custom View is displayed properly.
But now I do have a @IBInspectable (numerOfButtons: Int) and based on this number I want to add UIButtons programmatically to my custom view. My problem is now, that I want to align this buttons to a subview in my custom view. So I try to set my button frames programmatically. But when I do this in layoutSubviews() my subviews are not calculated based of my auto layout constraints. I tried to call setNeedsLayout() and layoutIfNeeded() of my subview but this does not work.
How can I get the correct frames of my subviews (with calculation of my constraints) to work with them in layoutSubviews()
Or what do I wrong?
By the way. It seems that my approach does not works only if I try to run with iPad Pro 9.7 inch simulator?!