How to set the Identifier of a UIView in Xcode/iOS for debugging auto layout? How to set the Identifier of a UIView in Xcode/iOS for debugging auto layout? ios ios

How to set the Identifier of a UIView in Xcode/iOS for debugging auto layout?


Setting accessibilityIdentifier on UIView does the trick. Tested on Xcode 6.4, iOS 8.4.


Seem like Identifier is only available on NSView in Mac OSX only. It's not available on UIView in iOS.

Find the bad constraint or constraints.

To get the constraints affecting a particular view, use constraintsAffectingLayoutForOrientation:. You can then inspect the constraints in the debugger. They are printed using the visual format notation. If your views have identifiers (see identifier (NSView)), they print out using the identifier in the description, like this:

As described in here:http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/AutolayoutPG/Articles/debugging.html


Unfortunately, there doesn't seem to be any way of doing this. I have tried filling almost everything, and nothing worked. Neither restorationId, nor Accessibility traits have any effect on this. If you look at the screenshot you will see that actually he is setting a NSView, which does have the identifier property.