问题描述
Label 属性的占位符文本是Xcode 特定标签",用 Google 搜索时什么也找不到.
The place holder text for the Label property is 'Xcode Specific Label', which when googled turns up nothing.
我假设它用于通过Xcode 特定标签"而不是按钮在 UI 中显示的实际文本来识别代码中的 UI 元素.如果是这样,我对在我的代码中使用它很感兴趣,因为我有具有相似功能的按钮,我想将其操作发送到相同的方法,并通过名称通过 sender 属性区分两者.我知道您可以通过对象 ID 执行此操作,但我认为使用名称会更清楚.我该怎么做?
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?
推荐答案
Label 字段标识 Xcode 中的 UI 元素.如果您使用标签文本字段命名 UI 元素,您会注意到该元素的名称在画布左侧的对象列表中发生了变化.
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.
Label 字段对代码的作用不大.它的存在是为了让 Xcode 中的事情更方便.事实上,身份检查器的整个身份部分的存在是为了让您在 Xcode 中更方便.假设您的窗口中有三个文本字段.为每个文本字段赋予不同的标签可以更轻松地识别每个文本字段.
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.
这篇关于Xcode 4 中身份检查器下的 Label 属性是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!