Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating an NSTimer subclass



El 9/11/2006, a las 21:42, j o a r escribió:

On 9 nov 2006, at 16.38, leenoori wrote:

Any one done this or have an idea of how to do it?

A very simple and safe way to do this would be to wrap NSTimer in a custom class, where each object has an NSTimer object as an instance variable. Then you just have to duplicate the parts of the NSTimer interface that you need on your custom class, and forward messages to your internal NSTimer object as appropriate.

Are you sure it would be simple? I thought about doing this and in fact started working on it, but then I asked myself:


How would you schedule such a timer, given that the method for doing so is actually in NSRunLoop (addTimer:forMode:)? What happens when you pass such a subclass to addTimer:forMode:? Class-dump shows no instance variables on NSTimer or its subclasses, nor any methods which look like candidates for use in adding a timer to a run loop.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Creating an NSTimer subclass (From: leenoori <email@hidden>)
 >Re: Creating an NSTimer subclass (From: j o a r <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.