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

Segue back and deselect cell animation like in default UITableViewCell #3

Closed
artworkad opened this issue Nov 11, 2014 · 4 comments
Closed

Comments

@artworkad
Copy link

Using UITableViewCell you get this effect when you first click on a cell, segue to another view and move back again. The cell is still selected and the selection state fades out animated. You can see it in the iPhone Settings app very clearly.

I noticed that BFPaperTableViewCell is not behaving that way. Are there plans to implement that?

@bfeher
Copy link
Owner

bfeher commented Nov 12, 2014

Hi ArtworkAD!

Because BFPaperTableViewCells do their own background highlighting, in their constructor I purposely set their selectionStyle to UITableViewCellSelectionStyleNone which is causing the behavior you describe.

If you are ok with the highlight looking a bit different, you can set
cell.selectionStyle = UITableViewCellSelectionStyleDefault;
in cellForRowAtIndexPath, or wherever you setup your cells, to bring back this behavior (similar to the Settings app).

If you are talking about adding a feature to BFPaperTableViewCell so that it's background fade remains upon selection and goes away on deselection, well I never thought of this. I'm not technically selecting or highlighting the cell, just drawing a layer on it. Also, cell selection is often handled by the tableView, not the cell itself.

However you have sparked my interest; I suppose I could override setSelected, setHighlighted, and prepareForReuse to imitate this kind of effect.

I'll let you know if I get this working nicely.

@artworkad
Copy link
Author

Thank you for this great explanation. I think UITableViewCellSelectionStyleDefault will be ok for me.

@bfeher
Copy link
Owner

bfeher commented Nov 13, 2014

Hello again,

I've pushed version 1.3.0 which now has two new properties:
CGFloat backgroundFadeAlpha
&
BOOL letBackgroundLinger (default YES).

Also now you no longer need to set cell.selectionStyle = UITableViewCellSelectionStyleDefault; because the background will linger until the cell is de-selected. You should find that it behaves just like the standard UITableViewCell in a standard UITableViewController.

Please let me know if you find any bugs. Thanks for suggesting this feature!

@artworkad
Copy link
Author

@bfeher this is awesome, thank you 👍

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

2 participants