Re: Where is the Computer Image ?
Re: Where is the Computer Image ?
- Subject: Re: Where is the Computer Image ?
- From: "Michael Ash" <email@hidden>
- Date: Mon, 15 Dec 2008 14:53:19 -0500
On Mon, Dec 15, 2008 at 1:35 PM, Clark Cox <email@hidden> wrote:
> On Mon, Dec 15, 2008 at 7:52 AM, Benjamin Dobson
> <email@hidden> wrote:
>> The image is already in Cocoa, named NSComputer.
>
> Don't use that name directly in your code, it's best to use the named
> constant: NSImageNameComputer.
Note that in this case, the major reason to use the constant is not
present: The constant is guaranteed to resolve to @"NSComputer", so
it's safe to use it that way. (This is done so that these images can
be used in nibs. Without guaranteed names you'd have to set them up in
code later.)
This guarantee does not apply to string constants in general, of
course! These NSImage constants are specifically guaranteed in the
docs. Other constants aren't, so if you look up what they point to and
use that string directly, you could break at any time!
Of course you're still correct that it's best to use the constant in
your code, simply because it's less typo-prone and works better with
various code editing tools. I just wanted to point out that it's not a
compatibility issue the way it is with others.
Mike
_______________________________________________
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