地図上にツイートを表示するアプリがあり、いずれかを選択すると、ツイートの詳細 (Twitter ハンドル、ツイート、プロフィール写真など) が表示されます。ツイートをお気に入りに追加してリツイートするためのボタンがあります。このアプリは、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];
}];
}
ツイートがユーザーによって既にリツイートまたはお気に入り登録されているかどうかを検出して、リツイート ボタンとお気に入りボタンに別のボタン イメージを表示するにはどうすればよいですか?