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
Description
This was a regression with the 8.0.90 update. We have a custom behavior
IconTintColorBehaviorbased off the CommunityToolkit behavior of the same name.Specifically, this is what colors the
UIButtonimage in that behavior:It looks like what caused this to stop working was the following code which can be found in
Button.iOS.csin functionResizeImageIfNecessary:(This is because the
UIImageneeds a rendering mode of typeAlwaysTemplateforTintColorto work)Steps to Reproduce
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