Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'adjustsImageWhenDisabled' was deprecated in iOS 15.0

Tags:

ios

swift

swiftui

Hey i get this Warning in my code and want to resolve it but i find no solution:

'adjustsImageWhenDisabled' was deprecated in iOS 15.0: This property is ignored when using UIButtonConfiguration, you may customize to replicate this behavior via a configurationUpdateHandler

Does anyone have an idea how to resolve the warning?

I have no idea how to solve it.

like image 296
CErdtmann Avatar asked Oct 17 '25 06:10

CErdtmann


1 Answers

You should set up a ConfigurationUpdateHandler where you should switch between your button states to set up your button's imageView's tintAdjustmentMode.

btn.configurationUpdateHandler = { button in
        switch button.state {
            case .disabled:
                button.imageView?.tintAdjustmentMode = .dimmed
                break
            default:
                button.imageView?.tintAdjustmentMode = .normal
                break
        }
    }
like image 134
May Rest in Peace Avatar answered Oct 19 '25 22:10

May Rest in Peace