Hello,
In my app, I have several System UIButtons with an image (Template Image) and tint colour. I am dynamically setting the buttons tint colour in viewDidLoad. The result is a button with an icon that have the same colour.
This works amazingly in all iOS versions prior to 13.
self.button.tintColor = tintColor;
On iOS13 and iOS13.1 it only works sometimes, so far I have not been able to diagnose why.
Instead of getting a button with an icon that are the same colour, I am getting a button that is the expected colour and an icon that is the default tint colour (blue).
The implementation of the buttons is the same in all view controllers but the unwanted behaviour only appears in some of the view controllers consistently.
The following code snipet fixes the unwanted behaviour in a number of view controllers, but not everywhere.
dispatch_async(dispatch_get_main_queue(), ^{
self.button.tintColor = tintColor;
});
The following code snipet seems to fix the unwanted behaviour everywhere:
self.button.tintColor = tintColor;
self.button.imageView.tintColor = tintColor;
I have tested it on both simulators and devices.
My question is what is causing this behaviour, is it expected? Am I doing something wrong?