I've been trying to figure out how to insert a handler to take action when a user taps on the message bubble. I've found the section in the readme about "customize your cells" and have tried a couple of different approaches, but so far no luck. Here's what I've tried:
Implemented:
- (void)collectionView:(JSQMessagesCollectionView *)collectionView didTapMessageBubbleAtIndexPath:(NSIndexPath *)indexPath
in my viewController
as:
override func collectionView(collectionView: JSQMessagesCollectionView, didTapMessageBubbleAtIndexPath indexPath: NSIndexPath!) {
super.collectionView(collectionView, didTapMessageBubbleAtIndexPath: indexPath)
println("They tapped!")
}
However, this doesn't seem to get called at all for some reason.
The other thing I've tried is implementing:
- (UICollectionViewCell *)collectionView:(JSQMessagesCollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
In my view controller as:
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = super.collectionView(collectionView, cellForItemAtIndexPath: indexPath) as! JSQMessagesCollectionViewCell
let myDelegate = MyJSQMessagesCollectionViewCellDelegate(origDelegate: cell.delegate!)
cell.delegate = myDelegate
return cell;
}
This gets called, but the methods in my delegate don't get invoked.
So, any suggestions on how I can properly get my JSQMessagesCollectionViewCellDelegate
put in place so that it gets invoked? Or is my initial attempt to just override the didTapMessageBubbleAtIndexPath
method the proper way to go?
Any suggestions are appreciated.