Re: Wait some seconds
Re: Wait some seconds
- Subject: Re: Wait some seconds
- From: Cameron Hayne <email@hidden>
- Date: Wed, 22 Jun 2005 21:30:47 -0400
On 22-Jun-05, at 3:50 PM, j o a r wrote:
This is what you're looking for:
<http://developer.apple.com/documentation/Cocoa/Reference/
Foundation/ObjC_classic/Classes/NSObject.html#//apple_ref/doc/uid/
20000050-performSelector_withObject_afterDelay_>
For usage guidelines (if the docs aren't enough), look in the list
archives and on the web.
If you want to perform the action only once after the activity has
stopped, you could use this utility function:
// The following is a utility routine that is used for postponing a
selector
// until after some activity is finished.
// It is designed to be repeatedly called while the activity is ongoing
// and it will result in the selector being invoked exactly once
// after the activity has finished.
+ (void)performOnce:(SEL)aSelector
withTarget:(id)aTarget
withObject:(id)anArgument
afterDelay:(NSTimeInterval)delay
{
// cancel any pending requests of this type
[NSObject cancelPreviousPerformRequestsWithTarget: aTarget
selector: aSelector
object: anArgument];
// schedule the request
[aTarget performSelector: aSelector
withObject: anArgument
afterDelay: delay];
}
--
Cameron Hayne
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden