【问题标题】:How to show retweets and like counts in iOS TwitterKit?如何在 iOS TwitterKit 中显示转发和喜欢计数?
【发布时间】:2018-05-15 12:23:19
【问题描述】:

在 twitterKit 中,有一个 tweetView 用于显示来自 tweet 模型对象的 Tweet,但在 tweetView 中没有显示转发和喜欢计数的字段。

cell.tweetView.showActionButtons = true;

这允许我们显示收藏和分享的操作按钮。但我想在每条推文中显示转推/点赞数。我该如何实现?

【问题讨论】:

    标签: ios twitter twitterkit


    【解决方案1】:

    只需将常规UITableViewCell 子类化并在其中使用TWTRTweetView。这基本上是 TWTRTweetTableViewCell 所做的,它有一个 tweetView 属性,它本质上是一个 TWTRTweetView 类型的 IBOutlet,并在 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

    【讨论】:

      猜你喜欢
      • 2019-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-16
      • 1970-01-01
      • 1970-01-01
      • 2020-11-04
      相关资源
      最近更新 更多