How can i display a Mapbox map in a JSQMessagesViewController bubble in swift? Any help would be appreciated.
如何在swift中的JSQMessagesViewController泡泡中显示Mapbox地图?任何帮助,将不胜感激。
1 个解决方案
#1
1
You have to create a class which conforms JSQMessageMediaData protocol to create your media data
您必须创建一个符合JSQMessageMediaData协议的类来创建媒体数据
Code:
码:
import JSQMessagesViewController
class ProductChatMsg: NSObject, JSQMessageMediaData {
func mediaView() -> UIView! {
let view = Bundle.main.loadNibNamed("XXView", owner: self, options: nil)?[0] as! UIView
return view
}
func mediaViewDisplaySize() -> CGSize {
return CGSize(width: 228, height: 156)
}
func mediaPlaceholderView() -> UIView! {
return UIView()
}
func mediaHash() -> UInt {
return UInt(self.hash)
}
}
#1
1
You have to create a class which conforms JSQMessageMediaData protocol to create your media data
您必须创建一个符合JSQMessageMediaData协议的类来创建媒体数据
Code:
码:
import JSQMessagesViewController
class ProductChatMsg: NSObject, JSQMessageMediaData {
func mediaView() -> UIView! {
let view = Bundle.main.loadNibNamed("XXView", owner: self, options: nil)?[0] as! UIView
return view
}
func mediaViewDisplaySize() -> CGSize {
return CGSize(width: 228, height: 156)
}
func mediaPlaceholderView() -> UIView! {
return UIView()
}
func mediaHash() -> UInt {
return UInt(self.hash)
}
}