I'm following the "Dynamic Stack View" part of this Stack View Apple tutorial, and I'm running into an constraint issue in Interface Builder if I leave the UIStackView
(within the UIScrollView
) empty, as opposed to putting a UIButton
inside it. I want my UIViewController
to dynamically create all of the arrangedSubviews
, so I don't want to leave a single UIView
in there that I will just have to handle or delete programmatically.
I can ignore the error and it will still work as I want, with no runtime constraint errors. However, I don't want to leave constraint issues within my xib/nib.
What's the cleanest way to satisfy Interface Builder? If I add a concrete height constraint, then I have to create an outlet for it and delete it programatically. That seems overly invasive and I'd rather leave as much Auto Layout in the xib/nib as possible.