HomeiOS Developmentuikit - Undesirable animations seem on UIButton (iOS 26)

uikit – Undesirable animations seem on UIButton (iOS 26)


https://youtube.com/shorts/YXl0ijziTyM?si=RMP2ZQuyFlVsfg8e

After the iOS 26 replace, undesirable animations seem on UIButton.

I am utilizing the attributedTitle property of UIButton.Configuration to alter the button’s textual content, and an animation seems after iOS 26. (It is unclear whether or not it is after iOS 26.0 or iOS 26.1, nevertheless it probably began with 26.1.)

The peculiar factor is that the animation solely begins showing on buttons which have been pressed as soon as.

I attempted utilizing UIView.performWithoutAnimation and CATransaction‘s start(), setDisableActions(true), commit(), nevertheless it did not work. How ought to I remedy this? Under is the code for altering the button’s textual content.

func updateTitle() {
        let keys = sort.keys
        if keys.rely == 1 {
            guard let key = keys.first else { return }
            if key.rely == 1 {
                if Character(key).isLowercase {
                    self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 24, weight: .regular), .foregroundColor: UIColor.label]))
                } else if Character(key).isUppercase {
                    self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 22, weight: .regular), .foregroundColor: UIColor.label]))
                } else {
                    self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 22, weight: .regular), .foregroundColor: UIColor.label]))
                }
            } else {
                self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 18, weight: .regular), .foregroundColor: UIColor.label]))
            }
            
        } else {
            let joined = keys.joined(separator: "")
            self.configuration?.attributedTitle = AttributedString(joined, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 22, weight: .regular), .foregroundColor: UIColor.label]))
        }
    }

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments