How to add height constraint to top UIView in hierarchy?
Question
I'm making a Today Widget Extension and the documentation says that I should use height constraints to determine its height.
But I can't set the constraints on the view, they all are greyed out and not available. I can set them on subviews, just not the top view.
Here is a screenshot:
How can I set height constraint on my top view?
Solution
You shouldn't or you cant.
The autolayout works in the relative way which needs a base setup to continue laying other layouts.And they prefer base setup as the base view in the viewcontroller.
The option is to do it to add the view into the main VC where it is displayed and let the constraints be set programatically
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow