Post

Replies

Boosts

Views

Activity

Nesting Manual Layout within Auto Layout views
We've had some success nesting Manual Layout (ML) (i.e., views that implement layoutSubviews() and sizeThatFits(...)) within Auto Layout (AL) views. This seems to work fine if the AL parent defines the size for the ML child. The ML child doesn't seem to participate in defining its size at all. In fact, sizeThatFits(...) is not called at all during the layout pass. This isn't surprising given the differences in the two systems. Ideally the sizeThatFits: method would get called with whatever the AL solver decided was appropriate, but I understand that this is complicated by chicken and egg problems - it's not this simple. For the case in which the ML child wants to define its own size without constraints (i.e., using CGFloat.greatestFiniteMagnitude size for sizeThatFits) I was hoping to leverage the intrinsicContentSize along with content hugging and compression resistance priorities to communicate size information up to the AL parent. This...almost works. I'm getting frames that seem to be taking the intrinsic size into account, but aren't exactly what I'd expect. Are there any other techniques I should be exploring here?
1
1
627
Jun ’20