Re: NSUserInterfaceItemIdentification -identifier vs -tag
Re: NSUserInterfaceItemIdentification -identifier vs -tag
- Subject: Re: NSUserInterfaceItemIdentification -identifier vs -tag
- From: "email@hidden" <email@hidden>
- Date: Wed, 09 Oct 2013 09:49:27 +0100
On 9 Oct 2013, at 05:32, Keary Suska <email@hidden> wrote:
> On Oct 8, 2013, at 3:25 PM, Lee Ann Rucker wrote:
>
>>
>> On Oct 8, 2013, at 1:59 PM, email@hidden wrote:
>>>>
>>>>
>>> -tag and -identifier both have the advantage of being accessible from within IB.
>>>
>>> J
>>
>> Any simple object can be assigned to a variable in IB, just set them in User Defined Runtime Attributes in the 3rd tab.
>
Thanks. I had forgotten about that.
representedObject can be set this way to a plist type on NSCell instances.
It would be possible to define an NSObject category property, say -myObjectName, backed by objc_setAssociatedObject and set that as a runtime attribute.
Likely overkill.
>
> I would also add that tags and identifiers are "dumb" values--that is they have no intrinsic significance and can be used any way you like (IMHO). I think identifiers are better than tags as they lend themselves to be more human-manageable and have a level of uniqueness enforced Unlike tags,
The readability and uniqueness of -identifier are attractive. -identifier is never(? - so far) nil so user code that utilises it should be able to deal with the auto generated values such as "_NS.154".
> however, there isn't a way (yet, that I know of) to reference a view by its identifier.
NSView implements NSUserInterfaceItemIdentification and this property can be set in Xcode 5 for a custom view.
NSMenuItem also implements NSUserInterfaceItemIdentification but Xcode 5 doesn't provide direct access to this property.
This would mean a different approach for menu and toolbar actions.
It looks as if plain old -tag might win out after all.
J
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden