• 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: Using performSelector:withObject:afterDelay: to call a delegate method?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using performSelector:withObject:afterDelay: to call a delegate method?


  • Subject: Re: Using performSelector:withObject:afterDelay: to call a delegate method?
  • From: Mike Abdullah <email@hidden>
  • Date: Fri, 1 Jan 2010 18:20:51 +0000

One caveat:

-performSelector:withObject:afterDelay: is defined in the NSObject class, not the NSObject protocol. Since most delegates are defined these days like so:

@protocol MyDelegate <NSObject>
...
@end

there is no guarantee the delegate itself will be able to handle -performSelector:withObject:afterDelay. You can get around this though by declaring your class as:

@property(assign) NSObject <MyDelegate> *delegate;

On 30 Dec 2009, at 19:21, Helen Cooper wrote:

> thanks - obvious. Should have caught this on my own:)
>
>
>
> ________________________________
> From: Bill Bumgarner <email@hidden>
> To: Helen Cooper <email@hidden>
> Cc: email@hidden
> Sent: Wed, December 30, 2009 12:37:38 PM
> Subject: Re: Using performSelector:withObject:afterDelay: to call a delegate method?
>
>
> On Dec 30, 2009, at 9:08 AM, Helen Cooper wrote:
>
>> [self performSelector:@selector(doSomething00) withObject:NULL afterDelay:4.0];
>>
>>
>> -(void)doSomething00{
>> [someDelegate doSomething];
>> }
>>
>> I am wondering though, if there might be a way to use  performSelector:withObject:afterDelay: (or some similar method) to call the delegate method directly?
>
>    [delegate performSelector:@selector(doSomething) withObject:nil afterDelay:4.0];
>
> b.bum
>
>
>
>
> _______________________________________________
>
> 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

_______________________________________________

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

  • Prev by Date: Re: NSImage
  • Next by Date: Re: NSImage
  • Previous by thread: Re: NSImage
  • Next by thread: Custom NSWindow drawing
  • Index(es):
    • Date
    • Thread