如何触发延迟,假设我想在3秒后调用一个方法(一次),如果需要,如何取消该调用?
你也可以使用-[NSObject performSelector:awithObject:afterDelay:],和+[NSObject cancelPreviousPerformRequestsWithTarget:selector:object].
-[NSObject performSelector:awithObject:afterDelay:]
+[NSObject cancelPreviousPerformRequestsWithTarget:selector:object]