The new UIButton.Configuration Api no subtle color transition

When I create a UIButton by new iOS15 api:

UIButton(configuration: .plain(), primaryAction: nil)

I lose the title fade transition that is provided by UIButton which created by old api:

UIButton(type: .system)

This is a feature or bug?

I think it is bad that system control lost the subtle animation. I hope Apple can fix it in the future version.

May I used it wrong? If I'm wrong, please help me fix it, thanks🙏

Replies

I lose the title fade transition

When should this transition occur ? When you tap the button ?

Did you consider using titleTextAttributesTransformer ?

It is a bit complex to use, here is a tutorial:

h t t p s : / / sarunw.com/posts/how-to-mark-custom-button-style-with-uibuttonconfiguration/

  • When button create by old api: When I put figure on the button, then button text change color to black with some alpha. And when I leave figure from button, the button text color fade to black color.

    In this video, I tapped the last button which created by old api, it has the good transition when text color change. Then I tapped the first button which created by new api, it not has any transition.

    h t t p s:/ /vimeo.com/627271705

  • I saw this tutorial, you can find, in the this post video, the button change background and foreground color when button state changed. but in the system UIBarButtonItem, and UIButton created by UIButton(type: .system) has a subtle transition when foreground color changed. I think this is better than no any transition. The new button api broke that. But in the UIBackgroundConfiguration document:

    "When you apply a configuration to a view, UIKit performs the actual drawing and rendering of the background. When you use background configurations instead of rendering your own backgrounds, the system provides automatic view hierarchy management, support for interactive and interruptible animations and transitions, and performance optimizations."

    So, I hope this is a bug. No transition is so bad.

Add a Comment

I have not had any luck using animation when using the new UIButton API made available for iOS 15 :(

Of course, I appreciate all the amazing work that's gone into iOS 15! However, it's the subtle animations like being able to change a UIButton's scale transform when a button is pressed, or animating a backgroundColor update that delights users. It's so close to being perfect and unfortunately, what may appear small is the reason I'll probably have to forgo adopting the new API for a long, long while.