-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
area-controls-buttonButton, ImageButtonButton, ImageButtonplatform/iospotential-regressionThis issue described a possible regression on a currently supported version., verification pendingThis issue described a possible regression on a currently supported version., verification pendingt/bugSomething isn't workingSomething isn't working
Milestone
Description
Description
This was a regression with the 8.0.90 update. We have a custom behavior IconTintColorBehavior
based off the CommunityToolkit behavior of the same name.
Specifically, this is what colors the UIButton
image in that behavior:
var image = button.ImageView.Image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
button.SetImage(image, UIControlState.Normal);
var platformColor = color.ToPlatform();
button.TintColor = platformColor;
button.ImageView.TintColor = platformColor;
It looks like what caused this to stop working was the following code which can be found in Button.iOS.cs
in function ResizeImageIfNecessary
:
image = image?.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
platformButton.SetImage(image, UIControlState.Normal);
(This is because the UIImage
needs a rendering mode of type AlwaysTemplate
for TintColor
to work)
Steps to Reproduce
- Open attached repo
- Click button to show second button
- Second button's icon will not be colored red
Link to public reproduction project repository
https://github.com/kklose23/maui-uibutton-tint
Version with bug
8.0.90 SR9
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.82 SR8.2
Affected platforms
iOS
Affected platform versions
No response
Did you find any workaround?
No
Relevant log output
No response
Metadata
Metadata
Assignees
Labels
area-controls-buttonButton, ImageButtonButton, ImageButtonplatform/iospotential-regressionThis issue described a possible regression on a currently supported version., verification pendingThis issue described a possible regression on a currently supported version., verification pendingt/bugSomething isn't workingSomething isn't working