Skip to content
This repository was archived by the owner on Aug 14, 2019. It is now read-only.
This repository was archived by the owner on Aug 14, 2019. It is now read-only.

Easier way to handle custom menu actions #810

Closed
@sebastianludwig

Description

@sebastianludwig

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 implement delete: and in the collection view delegate return YES for @selector(delete:) in collectionView:canPerformAction:forItemAtIndexPath:withSender:.

But collectionView:performAction:forItemAtIndexPath:withSender: is only called for actions like copy: or cut:. 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 method messagesCollectionViewCell: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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions