我有一个应用程序在地图上显示推文,当选择一个推文时,它显示推文的更多细节(推特手柄,推文,个人资料图片等)。有按钮用于收藏和转发推文。该应用程序使用STTwitter与Twitter API进行交互,并使用twitter = [STTwitterAPI twitterAPIOSWithFirstAccount];
对应用程序的用户进行身份验证。对于在推文详细信息视图中进行转发和收藏,我执行此操作:
- (IBAction)retweet:(id)sender {
[twitter postStatusRetweetWithID:tweetID successBlock:^(NSDictionary *status) {
UIAlertView *retweetSuccess = [[UIAlertView alloc]initWithTitle:@"Retweeted!" message:@"You have retweeted this post." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[retweetSuccess show];
} errorBlock:^(NSError *error) {
UIAlertView *retweetFailure = [[UIAlertView alloc]initWithTitle:@"Retweet Failed!" message:@"" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[retweetFailure show];
}];
}
- (IBAction)favorite:(id)sender {
[twitter postFavoriteCreateWithStatusID:tweetID includeEntities:nil successBlock:^(NSDictionary *status) {
UIAlertView *favoriteSuccess = [[UIAlertView alloc]initWithTitle:@"Favorited!" message:@"You have favorited this post." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[favoriteSuccess show];
} errorBlock:^(NSError *error) {
UIAlertView *favoriteFailure = [[UIAlertView alloc]initWithTitle:@"Favorite Failed!" message:@"" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[favoriteFailure show];
}];
}
我如何检测推文是否已被转发或被用户收藏,以便我可以为转推和收藏按钮显示不同的按钮图像?