Steve Moser
Steve Moser

Reputation: 7807

What is the Label property under the identity inspector in Xcode 4?

The place holder text for the Label property is 'Xcode Specific Label', which when googled turns up nothing.

I assumed it used for identifying the UI element in your code by it's 'Xcode Specific Label' and not the actual text that the button displays in the UI. If so I am interesting in using it in my code since I have buttons with similar functions whose actions I want to send to the same method and differentiate between the two with the sender property by name. I understand that you can do this through the object id but I think that using a name would be clearer. How would I do this?

Upvotes: 20

Views: 15521

Answers (2)

渠晓友
渠晓友

Reputation: 11

enter image description here

just the name you typed for the view in the Document Outline,It's a convenient way for you to identify the views in Xcode. as the image shows: I update the view's name to contentView, that means the view is the scrollView's ContentView.

Upvotes: 0

Swift Dev Journal
Swift Dev Journal

Reputation: 20088

The Label field identifies the UI element in Xcode. If you name the UI element using the Label text field, you'll notice that element's name changes in the object list, which is to the left of the canvas.

The Label field doesn't do much with regard to code. It exists to make things more convenient in Xcode. In fact, the whole Identity section of the identity inspector exists to make things more convenient for you in Xcode. Suppose you have three text fields in your window. Giving each text field a different label makes it easier to identify each text field.

Upvotes: 25

Related Questions