[NSTimer scheduledTimerWithTimeInterval:1.0
target:self selector: @selector(methodName:)
userInfo:nil repeats:NO];
Alternative to Part I [35], has the possibility of repetetive calls.
[NSTimer scheduledTimerWithTimeInterval:1.0
target:self selector: @selector(methodName:)
userInfo:nil repeats:NO];
Alternative to Part I [35], has the possibility of repetetive calls.
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/
[self performSelector:@selector(methodName) withObject:nil afterDelay:0.10f];
update: http://www.trembl.org/codec/58/