1

i've a problem with the position of my JSQmessage bubble.

when i "send" it the position is good but when i change the view then come back the bubble is more at left than before. (if i send a new one all bubble come back to a good position).

can someone now what can happen?

bubble at wrong position

enter image description here

bubble at good position (after new send)

enter image description here

4

2 回答 2

1

在你的ViewDidLoad()这个

viewDidLoad(){
    super.viewDidLoad()
    collectionView?.collectionViewLayout.incomingAvatarViewSize = .zero
    collectionView?.collectionViewLayout.outgoingAvatarViewSize = .zero
}

我也有这个功能,但我会假设基本相同。

override func collectionView(collectionView: JSQMessagesCollectionView!, avatarImageDataForItemAtIndexPath indexPath: NSIndexPath!) -> JSQMessageAvatarImageDataSource? {
    return nil
}
于 2016-02-17T22:47:50.213 回答
0

加载聊天记录后使用:

 dispatch_async(dispatch_get_main_queue(), ^{
    [self.collectionView reloadData];
});

此代码在目标 c 中,但我相信您可以将其转换为 swift :)

于 2016-02-19T18:14:50.287 回答