How do you properly dim tint colors when tintAdjustmentMode is active and using the new contentConfigurations?

Viewed 287

Say I want to mimic this "Shut Down" blue-tinted button in the iOS Settings app using the new (as of iOS 14) cell content configuration options:

iOS Settings app with blue Shut Down button cell

How would I do this in a way that would also allow it to be properly dimmed if a user presented, say, an alert controller over top? For the unaware in this case it "dims" all the interactive/tinted views like this one to a grey color. Here's an example where an alert controller is shown over a grid of UIImageView buttons with a normally blue tint where you can see they're grey due to the action sheet:

A series of icons beneath an action sheet that are now grey

But with cell content configurations, at least the default one, the only option I get for changing text color is via textProperties.color = ..., and since this isn't technically a "tint" (and there's no tint option I can see) it remains blue even when other views properly dim.

How do I fix this?

I tried reading the value of tintAdjustmentMode in the updateConfiguration method of the cell subclass, but it's not called for tintAdjustmentMode changes. I then tried calling setNeedsUpdateConfiguration() manually when tintColorDidChange() is called on the subclass, but that causes a brief delay in the color changing which looks bad/out of sync with other views.

Is there a way to do this that I'm missing?

0 Answers
Related