cancelPreviousPerformRequestsWithTarget方法

//2秒后开始执行testMethod方法
[self performSelector:@selector(testMethod:) withObject:@"a" afterDelay:2];

//取消执行方法,必须与调用方法的参数一致,否则不能取消成功
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(testMethod:) object:@"a"];

你可能感兴趣的:(cancelPreviousPerformRequestsWithTarget方法)