Perform selector on parent NSOperation
Posted
by user326943
on Stack Overflow
See other posts from Stack Overflow
or by user326943
Published on 2010-05-11T23:11:12Z
Indexed on
2010/05/12
1:24 UTC
Read the original article
Hit count: 373
I extend NSOperation (call it A) which contains NSOperationQueue for other NSOperations (which is another extended class different from A, call these operations B). When operation A is running (executing B operations) how do i call a specific function/method on operation A when certain event takes place on B operations? For example every operation B that finishes it calls a function on operation A returning itself?
*Nested NSOperation and NSOperationQueue(s)
Hope this mockup pseudo code can help to draw the picture.
//My classes extended from NSOperation
NSOperation ClassA
NSOperation ClassB
//MainApp
-(void)applicationDidFinishLaunching:(NSNotification *)aNotification {
ClassA A1;
ClassA A2;
NSOperationQueue Queue;
Queue AddOperation: A1;
Queue AddOperation: A2;
}
//Main of ClassA
-(void)main {
ClassB B1;
ClassB B2;
NSOperationQueue Queue;
Queue AddOperation: B1;
Queue AddOperation: B2;
}
//Main of ClassB
-(void)main {
//Do some work and when done call selector on ClassA above
}
© Stack Overflow or respective owner