Codec ░ method

374Delay method execution, part II

[NSTimer scheduledTimerWithTimeInterval:1.0
target:self selector: @selector(methodName:)
userInfo:nil repeats:NO];	

Alternative to Part I [35], has the possibility of repetetive calls.

58Delay method execution & passing objects along the way 35Delay method execution

58Delay method execution & passing objects along the way

Specific example. Deselect table cell after a certain time. TableView and indexPath are wrapped into an array and send along to the method for delayed execution.


- (void)tableView:(UITableView *)tView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"User selected row %d\n", [indexPath row] + 1);
// actions
[self performSelector:@selector(deselectTableCell:) withObject:[NSArray arrayWithObjects:tView, indexPath, nil] afterDelay:0.2f];
}

-(void) deselectTableCell:(NSArray *)array {
[[ [array objectAtIndex:0] cellForRowAtIndexPath:[array objectAtIndex:1] ] setSelected:NO];
NSLog(@"deselectTableCell" );
}

In additon to http://www.trembl.org/codec/35/

374Delay method execution, part II 87Absolute Time 35Delay method execution

35Delay method execution

[self performSelector:@selector(methodName) withObject:nil afterDelay:0.10f];

update: http://www.trembl.org/codec/58/

374Delay method execution, part II 87Absolute Time 58Delay method execution & passing objects along the way