• 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: Creating an NSTimer subclass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating an NSTimer subclass


  • Subject: Re: Creating an NSTimer subclass
  • From: leenoori <email@hidden>
  • Date: Fri, 10 Nov 2006 03:02:06 +0100

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Creating an NSTimer subclass
      • From: j o a r <email@hidden>
References: 
 >Creating an NSTimer subclass (From: leenoori <email@hidden>)
 >Re: Creating an NSTimer subclass (From: j o a r <email@hidden>)

  • Prev by Date: Re: Creating an NSTimer subclass
  • Next by Date: Re: Creating an NSTimer subclass
  • Previous by thread: Re: Creating an NSTimer subclass
  • Next by thread: Re: Creating an NSTimer subclass
  • Index(es):
    • Date
    • Thread