Re: Telling apart different save panels
Re: Telling apart different save panels
- Subject: Re: Telling apart different save panels
- From: Conrad Shultz <email@hidden>
- Date: Thu, 22 Sep 2011 15:52:09 -0700
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 9/22/11 3:34 PM, Graham Cox wrote:
>
> On 23/09/2011, at 5:20 AM, Seth Willits wrote:
>
>> On Sep 20, 2011, at 6:00 PM, douglas welton wrote:
>>
>>> I'm not sure that my solution is any "less messy" than what
>>> you have suggested, but... when faced with this same situation,
>>> I gave the save panel a different title each time it was
>>> invoked. When the panel object was passed to my delegate, I
>>> could tell where the panel was being used by the title of the
>>> inbound object. No need for subclasses or additional retains.
>>
>>
>>
>> You could use Obj-C associated objects for the same effect with
>> your own property instead of reusing title.
>
> Can you elaborate? I'm not sure what you mean by this.
Associated objects are a runtime feature that allow you to, well,
attach one or more objects to another one using a key-value mechanism.
They are often used to add pseudo-ivars in category methods.
See the documentation for objc_setAssociatedObject() and related
functions.
So instead of co-opting the title, one option is to store a panel
identifier as an associated object on the panel then look it up in
your delegate with objc_getAssociatedObject().
- --
Conrad Shultz
Synthetiq Solutions
www.synthetiqsolutions.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iD8DBQFOe7wZaOlrz5+0JdURAiwHAJ4uR5GZwLQLArB49bZbZXnOo7jN8ACeO/H5
Ylzo50e0qUdZlEYuXH0QObI=
=9P1f
-----END PGP SIGNATURE-----
_______________________________________________
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