2017-06-02 83 views

回答

1

你必須創建一個符合JSQMessageMediaData協議創建您的媒體數據

代碼的類:

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) 
} 
} 
相關問題