How fix width or/and height of a custom UI element in Xcode?

Viewed 363

I want to create custom UI Element as in Apple guide, and now has a question.

Can I fix width or/and height of my element as in UIActivityIndicator, UISearchBar etc as in picture:

fixed size?

I tried this:

translatesAutoresizingMaskIntoConstraints = false
heightAnchor.constraint(equalToConstant: 60).isActive = true

Custom view height got height only when I added constraints.
Height in properties window didn't fixed.
And also constraints conflict appears when I set height constraint in interface builder. This conflict does not appears when I does not change translatesAutoresizingMaskIntoConstraints property, but other troubles remains.

0 Answers
Related