Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Custom MenuItem For cell #552

Open
expertalex opened this issue Mar 7, 2018 · 5 comments
Open

Add Custom MenuItem For cell #552

expertalex opened this issue Mar 7, 2018 · 5 comments

Comments

@expertalex
Copy link

expertalex commented Mar 7, 2018

General Information

We want to add a custom menu actions for cells:

In JSQMessages we have:

    /**
     *  Register custom menu actions for cells.
     */
    [JSQMessagesCollectionViewCell registerMenuAction:@selector(customAction:)];

What happened?

In Message Kit found the following methods:

 override func collectionView(_ collectionView: UICollectionView, shouldShowMenuForItemAt indexPath: IndexPath) -> Bool {
        return true
    }
    
    override func collectionView(_ collectionView: UICollectionView, canPerformAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) -> Bool {
        
        print("action:\(action.description)")
        
        if(action ==  NSSelectorFromString("customAction:")){
            return true;
        }
        if(action == NSSelectorFromString("editCollection")){
            return true;
        }
        if(action == NSSelectorFromString("deleteCollection")){
            return true;
        }
        return true;
        
    }
    
    override func collectionView(_ collectionView: UICollectionView, performAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) {
        
        print("action:\(action.description)")
        
    }

I added the UIMenuItem in the UIMenuController in view did load without any results.

What did you expect to happen?

The new action stood appear in UIMenuController action list for each cell

@expertalex
Copy link
Author

Any progress?

@kmitj
Copy link

kmitj commented May 31, 2018

Any progress? how i can add custom actions ?

@SD10
Copy link
Member

SD10 commented May 31, 2018

@Michael-Snow No progress, this project is community driven 😢 I'd be open to a PR if this is something you want to work on?

@Luke47
Copy link

Luke47 commented Jun 6, 2018

@Michael-Snow @expertalex Have a look at #706

I hope it helps :)

@phungphuphang
Copy link

@expertalex Let try this code:
messagesCollectionView.delegate = self
I hope it helps.

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

No branches or pull requests

6 participants