将文字信息与泡沫中的图像结合起来

时间:2016-04-05 08:27:04

标签: ios swift jsqmessagesviewcontroller

如何在像Screenshot with android result

这样的气泡中合并图像和文字

目前,我唯一取得的成就是用

拆分它们
                let mediaItem = ChatImageJSQPhoto(image: image)
                let outgoingBool = chat.sender!.id != NetworkHelper.loggedInUser!.id
                mediaItem.appliesMediaViewMaskAsOutgoing = outgoingBool
                let photoMessage = JSQMessage(senderId: String(chat.sender!.id), senderDisplayName: chat.sender!.username, date: self.formatter.dateFromString(chat.dateTime), media: mediaItem)
                Alamofire.request(.GET, chat.gift!.image)
                    .responseImage { response in
                        if let image = response.result.value {
                            mediaItem.image = image

                            dispatch_async(dispatch_get_main_queue(), {
                                self.collectionView.reloadData()
                                self.finishReceivingMessage()
                            })
                        }

                }
                self.messages.append(photoMessage)
                //then get the message if it exists
                if chat.desc.characters.count > 0 {
                    self.addMessage(String(chat.sender!.id), senderName: chat.sender!.username, text: chat.desc, date: chat.dateTime)
                }

1 个答案:

答案 0 :(得分:0)

您可以使用自动布局实现此目的。您不知道如何实施项目

<强> H:|[imageView]-10-[uiLabel]|

有关自动布局可视化格式语言(VFL)的更多信息,请访问apple documenation