Iphone 从MGTwitterEngine返回状态
我在iPhone应用程序中使用MGTwitterEngine来简单调用用户状态。引擎有一个委托方法:Iphone 从MGTwitterEngine返回状态,iphone,objective-c,mgtwitterengine,Iphone,Objective C,Mgtwitterengine,我在iPhone应用程序中使用MGTwitterEngine来简单调用用户状态。引擎有一个委托方法: - (void)statusesReceived:(NSArray *)statuses forRequest:(NSString *)identifier 我可以在控制台上看到我的状态记录。我的问题是,使用状态并在收到状态时得到通知的最佳方式是什么 我想这可能更多的是关于如何正确使用委托模式 谢谢,我设置了一个NSNotification observer,然后从statusesReceiv
- (void)statusesReceived:(NSArray *)statuses forRequest:(NSString *)identifier
我可以在控制台上看到我的状态记录。我的问题是,使用状态并在收到状态时得到通知的最佳方式是什么
我想这可能更多的是关于如何正确使用委托模式
谢谢,我设置了一个NSNotification observer,然后从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.
}
我已经使用NSN通知部分解决了这个问题。NSNotification*notification=[NSNotification notificationWithName:@“TweetsRived”对象:self];有更好的办法吗?