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

adding the hide all but cell method #222

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joncode
Copy link

@joncode joncode commented Aug 12, 2014

I had a use case for the v2.0 Its On Me app where ... when you slide open one cell , it was required that any other open cell closed. I solved this use case by making a multi-purposed method that you could call from anywhere that resets any cell that isn't the cell you pass in. Pretty self explanatory. Thanks for the cool pod dude !

FYI, i overwrote in a base cell class in my version , I was un-able to overwrite as i am commiting below due to pod overwriting being a pain. So please run this before for any typos etc ... My base class version works perfectly .

[visibleCells addObject:[tableView cellForRowAtIndexPath:path]];
}

for (SWBaseCell *checkCell in visibleCells) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be changed from SWBaseCell to SWTableViewCell.

@davidquon
Copy link

Works as expected for me and solved a bug with my implementation of a similar method. 👍 for the PR.

NSMutableSet *visibleCells = [[NSMutableSet alloc] init];

for (NSIndexPath *path in paths) {
[visibleCells addObject:[tableView cellForRowAtIndexPath:path]];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An improvement would be to change this line to this.

SWTableViewCell *cellForRow = (SWTableViewCell *)[tableView cellForRowAtIndexPath:path];
if (cellForRow)
{
    [visibleCells addObject:cellForRow];
}

Without this change I've gotten the code to throw an exception here when hideUtilityButtons:exceptForCell:animated: is called in swipeableTableViewCellDidEndScrolling: and quickly showing the utility buttons and scrolling fast off the screen.

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

Successfully merging this pull request may close these issues.

2 participants