37

I call method sr in viewDidLoad with below code,how can i cancel it before that method sr will call?

[self performSelector:@selector(sr) withObject:nil afterDelay:20]; 
SajjadZare
  • 2,487
  • 4
  • 38
  • 68

1 Answers1

98
[NSObject cancelPreviousPerformRequestsWithTarget:self
                                         selector:@selector(sr)
                                           object:nil];

Please read the documentation. :) The documentation for -performSelector:withObject:afterDelay: points you to the methods for canceling a queued perform request.

CIFilter
  • 8,647
  • 4
  • 46
  • 66