¡@

Home 

2014/10/15 ¤U¤È 10:11:46

iphone Programming Glossary: myoperation

Subclassing NSOperation to be concurrent and cancellable

http://stackoverflow.com/questions/3859631/subclassing-nsoperation-to-be-concurrent-and-cancellable

this operation Let's deal with these in order. I'm going to assume that your subclass of NSOperation is called MyOperation just for ease of explanation. I'll explain what you're misunderstanding and then give a corrected example. 1. Running NSOperations.. NSOperation s with an NSOperationQueue and from your code it sounds like that's what you're doing. In that case your MyOperation will always be run on a background thread regardless of what the BOOL isConcurrent method returns since NSOperationQueue.. method and put it on an NSOperationQueue . The performSelectorOnMainThread in your code would cause every instance of MyOperation to always perform its task on the main thread. Since only one piece of code can be running on a thread at a time this means..