Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @interface JTTimerProxy : NSProxy {
- id target;
- NSTimeInterval delay;
- }
- - (id)initWithTarget:(id)aTarget delay:(NSTimeInterval)aDelay;
- @end
- @implementation JTTimerProxy
- - (id)initWithTarget:(id)aTarget delay:(NSTimeInterval)aDelay {
- target = aTarget;
- delay = aDelay;
- return self;
- }
- - (void)forwardInvocation:(NSInvocation *)anInvocation {
- [anInvocation setTarget:target];
- [NSTimer scheduledTimerWithTimeInterval:delay invocation:anInvocation repeats:NO];
- }
- - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector {
- return [target methodSignatureForSelector:aSelector];
- }
- @end
- @interface NSObject (JTTimerProxy)
- - (NSProxy *)schedulerWithDelay:(NSTimeInterval)seconds;
- @end
- @implementation NSObject (JTTimerProxy)
- - (NSProxy *)schedulerWithDelay:(NSTimeInterval)seconds {
- return [[[JTTimerProxy alloc] initWithTarget:self delay:seconds] autorelease];
- }
- @end
Add Comment
Please, Sign In to add comment