johnpatrickmorgan / wtfautolayout

The source code for Why The Failure, Auto Layout?
https://www.wtfautolayout.com
MIT License
1.07k stars 22 forks source link

Expanded message for `UIView-Encapsulated-Layout` constraints #6

Open pipelineoptika opened 6 years ago

pipelineoptika commented 6 years ago

UIView-Encapsulated-Layout-* constraints are commonly added by collection views et al, but are also the resultant constraints from translatesAutoresizingMaskIntoConstraints. In projects where constraints are being added to old frame-based layouts, knowing this can be really helpful.

johnpatrickmorgan commented 6 years ago

Thanks for raising this issue. I was under the impression that constraints that have been translated from autoresizing masks have an additional piece of info in their description, in the form h=--& v=--&. E.g.:

"<NSAutoresizingMaskLayoutConstraint:0x60000089a130 h=--& v=--& UIView:0x7f95000e5ac0.width == 70   (active)>"

Currently any descriptions that include this info are determined to have been translated from autoresizing masks, regardless of whether they have an identifier with the prefix UIView-Encapsulated-Layout-.

The documentation seems to confirm this. Are you seeing NSAutoresizingMaskLayoutConstraints printed without the h=--& v=--& info?

pipelineoptika commented 6 years ago

Not as such - what I'm seeing is this: "<NSLayoutConstraint:0x11a9ade60 'UIView-Encapsulated-Layout-Width' Document Base.width == 1366 (active, names: Document Base:0x1192fbcf0 )>", where Document Base is just the accessibilityIdentifier.

The main thing to note is that I have no table or collection views in the hierarchy, but I did have autoresizing masks that needed to be removed.

I don't know if this helps?

pipelineoptika commented 6 years ago

This is as at iOS 11, which appears to make some changes in this area. This post suggested it, and it seems reasonable based on what finally fixed my layout issue (which was correctly dealing with those masks).

https://stackoverflow.com/a/46738140/466345

johnpatrickmorgan commented 6 years ago

@pipelineoptika Thanks very much for the additional info; I will have a deeper look. Just to check, are you using any Auto Layout frameworks such as SnapKit in that project?

pipelineoptika commented 6 years ago

No, none - it's just vanilla XIBs.

pipelineoptika commented 6 years ago

By the way - thank you so much for this tool. It's helped us greatly! ❤️