• 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
NSInvocation or NSTimer with an arg
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSInvocation or NSTimer with an arg


  • Subject: NSInvocation or NSTimer with an arg
  • From: Luther Baker <email@hidden>
  • Date: Wed, 16 Sep 2009 19:24:12 -0500

I'd like to fire a simple callback every .1 of second (yes, my stopwatch
style app). But in that callback, I need access to a corresponding
UITableViewCell. Unfortunately, I don't see a way to choose a selector with
a UITableViewCell argument for the oneliner:

[NSTimer scheduledTimerWithTimeInterval:<#(NSTimeInterval)ti#>
target:<#(id)aTarget#> selector:<#(SEL)aSelector#> userInfo:<#(id)userInfo#>
repeats:<#(BOOL)yesOrNo#>

The other option is to use:

[NSTimer scheduledTimerWithTimeInterval:<#(NSTimeInterval)ti#>
invocation:<#(NSInvocation *)invocation#> repeats:<#(BOOL)yesOrNo#>

but this approach requires roughly 7 extra lines of code every time I
configure a cell for display (creating things like NSMethodSignature,
NSInvocation, setters, etc). It isn't enormous but suddenly, my generally
small cellForRowAtIndexPath is getting pretty long. I'm wondering if I
should be careful. Things like scrolling etc might blast through this and
I'd prefer to keep the method fairly light if, there was in fact a way to
use the simpler one liner to invoke a callback with an arg.

Again. I certainly appreciate any informal feedback/suggestions. Maybe
userInfo would apply for what I'm doing here? I thought userInfo would be
stored in the NSTimer and unfortunately, the single callback that everything
is firing to doesn't take the NSTimer as an arg so I think that means I'd be
tracking NSTimers external to the callback loop ... and I'd just rather
avoid that.

Thanks.
_______________________________________________

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

  • Follow-Ups:
    • Re: NSInvocation or NSTimer with an arg
      • From: "Hank Heijink (Mailinglists)" <email@hidden>
  • Prev by Date: CoreData and NSTimeInterval
  • Next by Date: CocoaDVDPlayer
  • Previous by thread: CoreData and NSTimeInterval
  • Next by thread: Re: NSInvocation or NSTimer with an arg
  • Index(es):
    • Date
    • Thread