Ambiguous height

Using Xcode 8.0 (8A218a)

I get "Ambiguous Height". although (in my opinion) I have limitations on the y axis.

Both of the two subzones within the view have a height (one has a height as a constraint, and one as the size of the content within itself).

See the image below for what it says "Debug View Hierarchy".

enter image description here

Constraints are created in code with the following code:

label UILabel , underscore UIView

 label.translatesAutoresizingMaskIntoConstraints = false underline.translatesAutoresizingMaskIntoConstraints = false addSubview(label) addSubview(underline) label.topAnchor.constraint(equalTo: topAnchor).isActive = true label.leftAnchor.constraint(equalTo: leftAnchor).isActive = true label.rightAnchor.constraint(equalTo: rightAnchor).isActive = true label.bottomAnchor.constraint(equalTo: underline.topAnchor, constant: -5).isActive = true underline.leftAnchor.constraint(equalTo: leftAnchor).isActive = true underline.rightAnchor.constraint(equalTo: rightAnchor).isActive = true underline.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true underline.heightAnchor.constraint(equalToConstant: 2.0).isActive = true 

Here's an example project extracted from a problematic project: https://github.com/everlof/LayoutIssue

+6
source share

Source: https://habr.com/ru/post/1012889/


All Articles