Re: NSTimer with userInfo
Re: NSTimer with userInfo
- Subject: Re: NSTimer with userInfo
- From: "Eric E. Dolecki" <email@hidden>
- Date: Tue, 12 May 2009 11:02:02 -0400
This is how I have this implemented at the moment (thoughts?) However I'm
not really seeing an animation to the selected state, it just kind of
happens
- (void)onTimer:(NSTimer *)timer {
[[[timer userInfo] objectForKey:@"table"] deselectRowAtIndexPath:[[timer
userInfo] objectForKey:@"indexPath"] animated:YES];
}
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *newCell = [tableView cellForRowAtIndexPath:indexPath];
[newCell setSelected:YES animated:YES];
NSMutableDictionary *myDictionary = [[NSMutableDictionary alloc] init];
[myDictionary setObject:tableView forKey:@"table"];
[myDictionary setObject:indexPath forKey:@"indexPath"];
[NSTimer scheduledTimerWithTimeInterval:0.5 target:self
selector:@selector(onTimer:)
userInfo:myDictionary repeats:NO];
}
On Tue, May 12, 2009 at 10:49 AM, Graham Cox <email@hidden> wrote:
>
> On 13/05/2009, at 12:42 AM, I. Savant wrote:
>
> Now, all I might need to do is to somehow package up the tableView and the
>>> indexPath and stuff that into something and declare that as the userInfo?
>>> And what might that look like?
>>>
>>
>> It would look like my previous response suggested. Use those
>> collection classes (NSDictionary, NSArray, etc.). In your case, I'd
>> use a dictionary with your table as the key "table", the index path as
>> key "indexPath", etc.
>>
>
>
> Normally the object receiving the timer callbacks is a controller that
> already knows about those objects, or has direct ways to get them. If not,
> you may have a design problem...
>
> --Graham
>
>
>
--
http://ericd.net
Interactive design and development
_______________________________________________
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