我设立一个NSNotification观察器,然后打电话去,从statusesReceived:forRequest。我还设置了一个NSArray iVar的代理方法,我访问我的NSNotification回调:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tweetNotificationHandler:) name:@"tweetsArrived" object:nil];
- (void)statusesReceived:(NSArray *)statuses forRequest:(NSString *)identifier{
tweets = statuses; //this is an ivar
NSNotification* notification = [NSNotification notificationWithName:@"tweetsArrived" object:self];
[[NSNotificationCenter defaultCenter] postNotification:notification];
}
-(void)tweetNotificationHandler: (NSNotification*)notification {
//do your results handling here.
}
我已经部分解决了这个使用NSNotifications。 \t NSNotification * notification = [NSNotification notificationWithName:@“tweetsArrived”object:self]; 有没有更好的方法? – codecowboy 2010-09-09 11:33:28