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

[FEATURE] Animated item selection #21

Open
D-Link13 opened this issue Nov 11, 2016 · 1 comment
Open

[FEATURE] Animated item selection #21

D-Link13 opened this issue Nov 11, 2016 · 1 comment
Labels

Comments

@D-Link13
Copy link

I would like to animate highlighting in styleForLabel, so i've overrides this method like this:
if highlighted { UIView.animate(withDuration: 0.5, animations: { label.transform = CGAffineTransform(scaleX: 1, y: 1) }) } else { UIView.animate(withDuration: 0.5, animations: { label.transform = CGAffineTransform(scaleX: 1/2.5, y: 1/2.5) }) }
But this gives me negative effect - it tries to animate labels before the view appears...
So i decided to give my VC an extra property - var beginAnimating = false, and set this to true in viewDidApear. Unfortunately this is not working as I expect =(
Please give me some advices with this issue. Thanks!

@filipealva
Copy link
Owner

The highlight occurs during a reload of PickerView. Since PickerView is built upon UITableView it happens during a reloadData, maybe you would need to wrap this animation in this code:

tableView.beginUpdates()
// animation code
tableView.endUpdates()

I think it could work.

@filipealva filipealva reopened this Oct 23, 2018
@filipealva filipealva changed the title Animate highlighting in styleForLabel [FEATURE] Animated item selection Oct 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants