Search code examples
iosswiftjsqmessagesviewcontroller

JSQMessagesViewController Click on message action


I have implemented JSQMessagesViewController into my app, and it has been excellent thus far.

However, I wish to allow a user to click on certain image messages in the list that would then take them to to another view controller.

Is this possible with JSQMessagesViewController?


Solution

  • Yes, you can do that, there is a delegate methods of JSQMessagesCollectionView

    func collectionView(collectionView: JSQMessagesCollectionView, didTapMessageBubbleAtIndexPath indexPath: NSIndexPath) {
    }
    

    from there you can get the data of selected bubble and as per the data you can redirect the user to the next controller.