操作のインデックスを NSOperationQueue に追加する必要があります。次のように機能することを願っています。
@interface MyOperation : NSObject {
NSInteger index;
/* Do Something */
}
以下は、myOperation のインデックス メンバーを operationQueue 内の位置として設定します。
[operationQueue addOperation:myOperation]
編集:実際には、NSMutableDictionary を使用して、操作のインデックスをオブジェクトとして、操作の名前をキーとして保存します。このように:
NSNumber* indexOfOperationInQueue;
NSMutableDictionary *dictionary;
...
-(void) AddOperation {
indexOfOperationInQueue = [NSNumber numberWithInt:value + 1];
[dictionary setObject:indexOfOperationInQueue forKey:@"operation0"];
}
操作はキャンセルされ、crosspond キーとオブジェクトは削除されました。