我設立一個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