cancelPreviousPerformRequest vs cancelAllOperations
i use now both but i'm not sur开发者_如何学JAVAe which is better. what is exactly the difference? fuzzy question i know. preparing for wwdc
Sending a cancelAllOperations
message to an operation queue cancels all the operations in that queue (that is, it tells the operations to cancel), whereas cancelPreviousPerformRequestsWithTarget:
tells the target object to cancel all delayed performs it had previously been told to do.
There is no “better” here; the two methods are incomparable. One cancels NSOperations; the other cancels delayed-perform requests. Which cancellation you use depends entirely on whether you made an NSOperation and put it an NSOperationQueue or sent a delayed-perform request.
精彩评论