• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSUserInterfaceItemIdentification -identifier vs -tag
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUserInterfaceItemIdentification -identifier vs -tag


  • Subject: Re: NSUserInterfaceItemIdentification -identifier vs -tag
  • From: Keary Suska <email@hidden>
  • Date: Tue, 08 Oct 2013 22:32:34 -0600

On Oct 8, 2013, at 3:25 PM, Lee Ann Rucker wrote:

>
> On Oct 8, 2013, at 1:59 PM, email@hidden wrote:
>
>> On 8 Oct 2013, at 21:54, Lee Ann Rucker <email@hidden> wrote:
>>
>>>
>>> On Oct 8, 2013, at 1:47 PM, email@hidden wrote:
>>>
>>>> The NSControl -tag property can be used to identify an action sender.
>>>>
>>>> Can the NSUserInterfaceItemIdentification protocol property -identifier be safely used for the same purpose?
>>>
>>> I don't know, but I'd prefer representedObject for something like that - it'll only be used by your code, so you don't have any restrictions to worry about.
>>>
>> -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.


To refute, or simply to be clear, as I understand (and I have been bitten by this accidentally) you can only assign values to defined (and possibly KVC-compliant) properties of an object in IB. If the specified key isn't defined, it will generate an exception. Also you can only assign a value of the defined types, and not just any object.

So, you can assign arbitrary values but you cannot define arbitrary properties to existing objects, at least unless that has recently changed (haven't tested since 4.3).

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, however, there isn't a way (yet, that I know of) to reference a view by its identifier.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

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


  • Follow-Ups:
    • Re: NSUserInterfaceItemIdentification -identifier vs -tag
      • From: "email@hidden" <email@hidden>
References: 
 >NSUserInterfaceItemIdentification -identifier vs -tag (From: "email@hidden" <email@hidden>)
 >Re: NSUserInterfaceItemIdentification -identifier vs -tag (From: Lee Ann Rucker <email@hidden>)
 >Re: NSUserInterfaceItemIdentification -identifier vs -tag (From: "email@hidden" <email@hidden>)
 >Re: NSUserInterfaceItemIdentification -identifier vs -tag (From: Lee Ann Rucker <email@hidden>)

  • Prev by Date: Re: Infinite Scroll View?
  • Next by Date: Re: NSUserInterfaceItemIdentification -identifier vs -tag
  • Previous by thread: Re: NSUserInterfaceItemIdentification -identifier vs -tag
  • Next by thread: Re: NSUserInterfaceItemIdentification -identifier vs -tag
  • Index(es):
    • Date
    • Thread