-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Easier way to handle custom menu actions #810
Comments
Thanks @sebastianludwig 👍 I agree, the API around this is clunky and makes me 😢 Your suggestion sounds great — I'd love to see it. I hate |
+1, I have to check this out. The new versions of JSQ, while awesome overall, made custom message actions a nightmare. |
@galambalazs - PR #811 adds this functionality and I'm planning on merging it for the next release. |
@jessesquires Wow, awesome man. Thanks :) |
4000 stars to celebrate 7.0.0 |
Hi,
Also override method
but i get crash on menu item what else to be done to work, any help would be appreciated, thanks in advance. |
What does the exception message say? Where and when exactly does the app crash? |
Hi,
I've tried to add a Delete action to the cell menu. I read #393 #483 and #569. As suggested I added a category on
JSQMessagesCollectionViewCell
to implementdelete:
and in the collection view delegate returnYES
for@selector(delete:)
incollectionView:canPerformAction:forItemAtIndexPath:withSender:
.But
collectionView:performAction:forItemAtIndexPath:withSender:
is only called for actions likecopy:
orcut:
. A look at the disassembly revealed that the the cell holds an internal reference to the collection view and dispatches the messages to the delegate this way.This is difficult to achieve with JSQ because the only way to add references through categories is using associated objects or subclassing which brings it's own problems and seems overkill.
I think it'd be cleanest to extend the
JSQMessagesCollectionViewCellDelegate
with a methodmessagesCollectionViewCell:performAction:withSender:
(maybe optional). This would make it easy and straight forward to implement custom actions and perform the actual task where it belongs (not in the cell).The only way to make it even easier would be to add an accessible reference to the collection view and dispatch to the
UICollectionViewDelegate
all the time (like Apple does).What do you think? If you agree I'm happy to implement it and send a pull request.
The text was updated successfully, but these errors were encountered: