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://codec.trembl.org/35/