/thirdparty/SPMediaKeyTap/SPInvocationGrabbing/gistfile3.m

http://github.com/tomahawk-player/tomahawk · Objective C · 28 lines · 19 code · 4 blank · 5 comment · 0 complexity · 1794e4fc655ea831def78ad9b3b22f5d MD5 · raw file

  1. // A
  2. +(UIView*)flashAt:(CGRect)r in:(UIView*)parent color:(UIColor*)color;
  3. {
  4. float duration = 0.5;
  5. UIView *flash = [[[UIView alloc] initWithFrame:r] autorelease];
  6. flash.backgroundColor = color;
  7. [parent addSubview:flash];
  8. [[flash invokeAfter:duration+0.1] removeFromSuperview];
  9. [UIView beginAnimations:@"SPFlash" context:NULL];
  10. [UIView setAnimationDuration:duration];
  11. flash.alpha = 0.0;
  12. [UIView commitAnimations];
  13. return flash;
  14. }
  15. // B
  16. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  17. // Force the animation to happen by calling this method again after a small
  18. // delay - see http://blog.instapaper.com/post/53568356
  19. [[self nextRunloop] delayedTableViewDidSelectRowAtIndexPath: indexPath];
  20. }
  21. // C
  22. [[tableView invokeAfter:0.15] selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
  23. [[tableView invokeAfter:0.30] deselectRowAtIndexPath:indexPath animated:YES];
  24. [[tableView invokeAfter:0.45] selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];