Question

UIWindow has the private method _autolayoutTrace that helps you to find ambigous layouts. It's very nice and convenient and outputs something like this:

*<UIWindow:0x13436fd0> - AMBIGUOUS LAYOUT
|   *<UIView:0xd5e0b30>
|   |   *<PbJellyContentContainerView:0xd5e0ff0>
|   |   |   *<UIView:0x20710ee0>
|   |   |   |   *<PbMapContainerView:0x20710c90>
|   |   |   |   |   <MKMapView:0x2070df70>
|   |   |   |   |   |   <UIView:0xd1cca20>
|   |   |   |   |   |   |   <MKBasicMapView:0xd1cd020>
....

My question is not about any ambiguity. It is about the asterisk in front of some views. What is its meaning?

My guess would be that it marks all views that are using auto layout. But how does the system determine this?

Update:

It seems that the asterisk marks all views that either have at least one constraint set or that have a subview that has at least one constraint set.

Setting translatesAutoresizingMaskIntoConstraints to false without setting a constraint doesn't give the asterisk.

Était-ce utile?

La solution

This is the legend for -[UIView _autolayoutTrace] from WWDC 2015 session #219 video at 31:00

* - is laid out with auto layout
+ - is laid out manually, but is represented in the layout engine because translatesAutoresizingMaskIntoConstraints = YES
• - layout engine host

Autres conseils

I got your point,i think so, * is for the the components on which you can apply Autolayout. I means if there is button then it will show it as

*<UIRoundedRectButton:0x1f053a50>
|   |   |   <UIGroupTableViewCellBackground:0x1f053b20>
|   |   |   <UIImageView:0x1f0542f0>
|   |   |   <UIButtonLabel:0x1f053db0>

that means that rectButton is put up by you and you can apply autolayout on that, whereas other 3 under are automatically will be layed out itself.

* will be only shown if atleast 1 component in your UI has UIAutolayout ON, if all of your components is without Autolayout, then it understand whole UIView as single component and will not show * for that

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top