Each UIView on a storyboard has a unique Object ID which looks something like: kvf-NI-koG
I'm wondering is there a way to make this more human-friendly, for example 'myLabel'?
Each UIView on a storyboard has a unique Object ID which looks something like: kvf-NI-koG
I'm wondering is there a way to make this more human-friendly, for example 'myLabel'?
You cannot change the object ID through Interface Builder.
Xcode uses the object ID in the storyboard (or XIB) file to refer to that object from other objects. Since a storyboard (or XIB) is an XML file, you can also “diff” versions of the file to try to understand (or merge) changes, and the object ID can help you correlate the entities in the file with the objects in Interface Builder.
The public API doesn't expose the object ID. So from your program's point of view, the object ID doesn't even exist.
You can set the view's label (in the text box with placeholder “Xcode Specific Label”). That label is used in the document outline (along the left side of the Interface Builder pane), and when wiring up connections and constraints. But that label is also not exposed to your program in the public API.
Not sure if this still matters - and if it would help at all -, but if You open the storyboard as source code (just select it in the file navigator on the left, right-click, and select Open As -> Source Code): in the XML source code that the storyboard is (originally, before compiling), You can see the object-IDs for each item, and change them in code. This would be reflected in the Interface Builder view of the storyboard (just use Open As -> Interface Builder-Storyboard).
Not sure if this is a wise idea, though! (Not sure of its implications.)
Cheers, Björn
© 2022 - 2024 — McMap. All rights reserved.