wtfautolayout icon indicating copy to clipboard operation
wtfautolayout copied to clipboard

Expanded message for `UIView-Encapsulated-Layout` constraints

Open pipelineoptika opened this issue 8 years ago • 6 comments

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.

pipelineoptika avatar Nov 27 '17 06:11 pipelineoptika

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?

johnpatrickmorgan avatar Nov 27 '17 23:11 johnpatrickmorgan

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 avatar Nov 28 '17 23:11 pipelineoptika

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

pipelineoptika avatar Nov 28 '17 23:11 pipelineoptika

@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?

johnpatrickmorgan avatar Nov 30 '17 21:11 johnpatrickmorgan

No, none - it's just vanilla XIBs.

pipelineoptika avatar Nov 30 '17 23:11 pipelineoptika

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

pipelineoptika avatar Nov 30 '17 23:11 pipelineoptika