material-components-ios icon indicating copy to clipboard operation
material-components-ios copied to clipboard

[Buttons] How to animate expanded <-> normal

Open peterwarbo opened this issue 3 years ago • 0 comments

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)

peterwarbo avatar May 24 '21 08:05 peterwarbo