material-components-ios
material-components-ios copied to clipboard
[Buttons] How to animate expanded <-> normal
I'm trying to animate between the different states of expanded and normal but it doesn't look good.
This is how I'm doing it:
normal
button.setTitle(nil, for: .normal)
button.setImage(UIImage(named: "icon"), for: .normal)
button.setMode(.normal, animated: animated)
expanded
button.setTitle("title", for: .normal)
button.setImage(UIImage(named: "icon"), for: .normal)
button.setMode(.expanded, animated: animated)
The animation in particular doesn't look good when going from expanded to normal, see attached video.
Platform (please complete the following information)
- Device: iPhoneSE
- OS: iOS14.5
- MaterialComponents/Buttons (109.4.0)