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

Reasoning behind default call to cleanupBackView. #14

Closed
cconstable opened this issue Jul 19, 2013 · 3 comments
Closed

Reasoning behind default call to cleanupBackView. #14

cconstable opened this issue Jul 19, 2013 · 3 comments

Comments

@cconstable
Copy link
Contributor

Just wanted to understand the reasoning behind defaulting to calling - (void)cleanupBackView after every cell pan animation / swipe completes.

For those reading this who aren't familiar with - (void)cleanupBackView, destroys and recreates the backView property (i.e. all your custom views need to be re-created).

I can see how it would be beneficial to get a fresh start in some cases but destroying and recreating the entire backView seems a bit over-kill to me in many situations. It also increases the complexity of the code (in your example, you create getters that check to see if the "check mark" or "X" image view had been destroyed).

I may add a property that disables this behavior unless there is something I'm not understanding.

@runmad
Copy link
Owner

runmad commented Jul 19, 2013

Feel free to submit a pull request if you've got a better solution up your sleeve and I'll have a look.

Thanks for the feedback!

@cconstable
Copy link
Contributor Author

I added a delegate method to give users the option of specifying whether the backView needs to be recreated or not:

- (BOOL)swipeTableViewCellShouldCleanupBackView:(RMSwipeTableViewCell *)swipeTableViewCell
{
    // Check the state of the cell... If things are out-dated or just in need of serious
    // cleanup we can return YES to have the backView re-created.

    // Otherwise, let's not do work we don't need to :)
    return NO;
}

@cconstable
Copy link
Contributor Author

Oops! Opened a new ticket for this sorry! Closing this one.

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

2 participants