#import "MSMutableArray.h"
@implementation MSMutableArray
- (void) addObjectInArray:(id)anObject
{
[self addObject:anObject];
// Notify the current Class that an element has been added
[[NSNotificationCenter defaultCenter]postNotification:@"arrayUpdated withObject:nil]
}
@end
In the class using the array.
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(myMethod):...
-(void)myMethod{
//do stuff here
}
It may be better to use notification (as explained above) or create a delegate for the class doing the network request and when the data comes in; update the array and then send the message. I don't think it is necessary /borderline bad design to teach the array to do this. It breaks the cohesion principle of a class design