2017-12-01 6 views
3

twitterKitには、tweetモデルオブジェクトからTweetを表示するためのtweetViewがありますが、tweetViewにリトウェットと好きなカウントを表示するフィールドはありません。iOS TwitterKitでリツイートと同様のカウントを表示するには?

cell.tweetView.showActionButtons = true; 

これにより、お気に入りと共有のアクションボタンを表示することができます。しかし、私はそれぞれのつぶやきにretweet/likesカウントを表示したい。どのように達成できますか?

答えて

0

標準UITableViewCellをサブクラス化し、内部にTWTRTweetViewを使用するだけです。基本的にはTWTRTweetTableViewCellと同じですが、基本的にタイプがTWTRTweetViewのIBOutletであるtweetViewプロパティがあり、その代わりにtableviewセルで使用されます。

like and retweetsのカスタムラベルをTWTRTweetViewの上の適切な位置に配置します。詳細情報については

- (void)configureCell:(TWTRTweet *)tweet{ 
    self.customTweetView.showActionButtons = true; 
    [self.customTweetView configureWithTweet:tweet]; 
    self.likesCount.text = [NSString stringWithFormat:@"%lld", tweet.likeCount]; 
    self.retweetsCount.text = [NSString stringWithFormat:@"%lld", tweet.retweetCount]; 
} 

check this SO post

関連する問題