NSInvocation or NSTimer with an arg
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