【问题标题】:Where is the condition of align messages to the left and to the right in Official Example?官方示例中消息左对齐和右对齐的条件在哪里?
【发布时间】:2021-02-18 14:48:56
【问题描述】:

我已经下载并学习了官方的 MessageKit 示例。 我自己的消息显示在右侧,对手的消息显示在左侧。但是,我在代码中找不到确定消息显示位置(左或右)的条件。也就是说,这个逻辑是在哪里实现的?

看起来像这样的逻辑。但是,此逻辑仅适用于在消息中显示尾部。

func messageStyle(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> MessageStyle {

    let tail: MessageStyle.TailCorner = isFromCurrentSender(message: message) ? .bottomRight : .bottomLeft

    return .bubbleTail(tail, .curved)
}

Official MessageKit Example

【问题讨论】:

    标签: messagekit


    【解决方案1】:

    原来比较逻辑在框架里面。比较发生在消息的发送者和数据的当前发送者之间。

    【讨论】:

      猜你喜欢
      • 2017-09-19
      • 2013-09-11
      • 2018-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多