• 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: Telling apart different save panels
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Telling apart different save panels


  • Subject: Re: Telling apart different save panels
  • From: Graham Cox <email@hidden>
  • Date: Fri, 23 Sep 2011 08:34:38 +1000

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.


> Another simple way of solving the original problem is to have an instance variable for the sheet and use a comparison to distinguish them in the delegate methods.


I specifically didn't want to use that solution because the class is spread across numerous categories and adding ivars to support stuff in categories is troublesome from a code management point of view. Apart from that, adding an ivar breaks the otherwise extremely neat encapsulation of the task into a single method that has no external references - blocks make that possible, but the need for a delegate somewhat undermines that benefit.

Kyle's solution was fine for my case, so it's a solved issue.

--Graham


_______________________________________________

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: Telling apart different save panels
      • From: Conrad Shultz <email@hidden>
References: 
 >Telling apart different save panels (From: Graham Cox <email@hidden>)
 >Re: Telling apart different save panels (From: douglas welton <email@hidden>)
 >Re: Telling apart different save panels (From: Seth Willits <email@hidden>)

  • Prev by Date: Re: UTI in Lion
  • Next by Date: Re: UTI in Lion
  • Previous by thread: Re: Telling apart different save panels
  • Next by thread: Re: Telling apart different save panels
  • Index(es):
    • Date
    • Thread