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

Question: custom cell actions. #6

Closed
SlavinskiySergey opened this issue Sep 10, 2018 · 4 comments
Closed

Question: custom cell actions. #6

SlavinskiySergey opened this issue Sep 10, 2018 · 4 comments

Comments

@SlavinskiySergey
Copy link

What is the preferred way to provide actions on cell?
I mean something like in https://github.com/maxsokolov/TableKit#row-actions>.
Thanks in advance.

@SlavinskiySergey SlavinskiySergey changed the title Custom cell actions. Question: custom cell actions. Sep 10, 2018
@dehlen
Copy link
Contributor

dehlen commented Sep 17, 2018

Currently I am doing it like this: (code based on Demo target)

extension VenueDetailViewController: UICollectionViewDelegate {
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        print(data.cellDeclarations[indexPath.row])
    }
}

You can the switch over the data.cellDeclarations[indexPath.row] and handle your action accordingly.

@ishkawa
Copy link
Owner

ishkawa commented Sep 20, 2018

Yes, @dehlen's explanation is exactly the same as my opinion.

@SlavinskiySergey
Copy link
Author

@dehlen , @ishkawa .
For ex., I have two buttons on my custom cell. How to differentiate taps on each of them?

@dehlen
Copy link
Contributor

dehlen commented Sep 20, 2018

You can configure your buttons selectors in the configureCell closure or set a tag for your UIButtons for example.

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

No branches or pull requests

3 participants