Estoy trabajando con un NSOperationQueue y quiero agregar nuevas NSOperations a NSOperationQueue. Es una cola que vive en una instancia única de una clase que tengo. Sería mucho más fácil si pudiera mover todo a la clase estática pasando al delegado.¿Puedo pasar delegado como un parámetro objetivo-c
Aquí está mi código ahora, ya que vive en - esto es en un cellForRowAtIndexPath
NSString *key = [NSString stringWithFormat:@"%@%@",cell.dataItem.ItemID, cell.dataItem.ManufacturerID];
if (![self.imgOperationInQueue valueForKey:key]) {
ImageOperation *imgOp = [[ImageOperation alloc] initWithItemID:cell.dataItem.ItemID withManufacturerID:cell.dataItem.ManufacturerID withReurnType:kThumbnail];
imgOp.identifier = [NSString stringWithFormat:@"%i", cell.tag];
imgOp.delegate = self;
[[SharedFunctions sharedInstance] addImageOperationToQueue:imgOp];
[imgOp release];
// store these in the dictionary so we don;t queue up requests more than once
[self.imgOperationInQueue setValue:cell.dataItem.ItemID forKey:key];
}
Si pudiera añadir el delegado como un parámetro que podría poner todos este código en la clase Singleton compartida y llamarlo desde cualquier lugar de mi aplicación
Supongo que podría usar una NSNotificación, o puedo usar un bloque de algún tipo?