ios - Issue with JSQMessages Displaying Test Messages -


when add multiple test messages, 2 of them displaying on screen. other messages there because can copy them, colors not showing. when scroll around, new 2 texts appear, still two. below show examples.

this image shows when screen first loads.

this image shows screen after i've scrolled around bit.

this image shows messages there, bubbles not showing up.

first screenshot shows when screen first loads. second shows when move around. third shows other messages exist not visible. ideas on how fix this? also, how make names appear? there guide doing in swift?

here code used:

    var messages = [jsqmessage]()  var incomingbubbleimageview = jsqmessagesbubbleimagefactory.incomingmessagebubbleimageviewwithcolor(uicolor.jsq_messagebubblelightgraycolor()) var outgoingbubbleimageview = jsqmessagesbubbleimagefactory.outgoingmessagebubbleimageviewwithcolor(uicolor.jsq_messagebubblegreencolor())  override func viewdidload() {     super.viewdidload()      self.sender = uidevice.currentdevice().identifierforvendor?.uuidstring      messages += [jsqmessage(text: "hello", sender: self.sender)]     messages += [jsqmessage(text: "hello", sender: "other")]     messages += [jsqmessage(text: "hello", sender: self.sender)]     messages += [jsqmessage(text: "hello", sender: "other")]     messages += [jsqmessage(text: "hello", sender: self.sender)]     messages += [jsqmessage(text: "hello", sender: "other")]      reloadmessagesview()  }  func reloadmessagesview() {     self.collectionview?.reloaddata() } 

and here extension code delegate methods:

extension testjsq {  override func collectionview(collectionview: uicollectionview, numberofitemsinsection section: int) -> int {     print(self.messages.count)     return self.messages.count }  override func collectionview(collectionview: jsqmessagescollectionview!, messagedataforitematindexpath indexpath: nsindexpath!) -> jsqmessagedata! {     let data = self.messages[indexpath.row]     return data } 

// override func collectionview(collectionview: jsqmessagescollectionview!, diddeletemessageatindexpath indexpath: nsindexpath!) { // self.messages.removeatindex(indexpath.row)

override func collectionview(collectionview: jsqmessagescollectionview, bubbleimageviewforitematindexpath indexpath: nsindexpath) -> uiimageview {      let data = messages[indexpath.row]     switch(data.sender) {     case self.sender:         return self.outgoingbubbleimageview     default:         return self.incomingbubbleimageview     }      }  override func collectionview(collectionview: jsqmessagescollectionview!, avatarimageviewforitematindexpath indexpath: nsindexpath!) -> uiimageview! {     return nil } 

}

any appreciated!!!


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -