. TTPhotoSource modelDidFinishLoad: , ... TTPhotoViewController , .
, . , , TTPhotoViewController . , , TTP- modelDidFinishLoad: , .
, , TTModel, NSMutableArray, , .
... TTPhotoViewController...
- (NSMutableArray*)delegates {
return [self mutableArrayValueForKey:@"superDelegates"];
}
- (void)insertObject:(id)object inSuperDelegatesAtIndex:(NSUInteger)index {
[super.delegates insertObject:object atIndex:index];
if ([self isLoaded]) {
if ([object respondsToSelector:@selector(modelDidFinishLoad:)]) {
[object performSelector:@selector(modelDidFinishLoad:) withObject:self];
}
}
}
- (void)removeObjectFromSuperDelegatesAtIndex:(NSUInteger)index {
[super.delegates removeObjectAtIndex:index];
}
- (NSArray*) superDelegates {
return super.delegates;
}
"" superDelegates, NSArray, NSMutableArray. insertObject: inSuperDelegatesAtIndex: removeObjectFromSuperDelegatesAtIndex: "superDelegates", ( , ) mutableArrayValueForKey: -, NSMutableArray, superDelegates, insertObject: inSuperDelegatesAtIndex: removeObjectFromSuperDelegatesAtIndex:.
Then all you have to do is redefine the delegates method to return such a generated proxy, and poof, all changes to the array are triggered through you, which allows you to send the correct download notification when connecting to TTPhotoViewController.
source
share