I have a PNG file that's an arrow that I'd like to use as an icon in an iOS app. I've dropped other PNG files into Xcode and they work fine as tintable UIButton
images using this line as an example:
[self.backButton setTintColor:[UIColor redColor]];
With the PNG file I dropped in, the file I'm dropping in is transparent except for the arrow, which is black. The code above does nothing to the image I'm trying to tint.
I've found other posts covering this topic, but rather than type 10-20 lines of code for each icon I've got on a UIButton
, I'd rather save it with the correct settings in Gimp and just reference the file in Xcode.
What settings should I pay attention to when saving the file as a PNG in Gimp?
Update
I initially thought adding the tint was causing my app to crash, however a cache clean resolved that issue. Regardless, my UIButton
with a PNG background won't change tints. It's always black, though it turns charcoal (darkGray?) colored if the button is disabled.
Update 2 I've tried this without any luck:
self.backButton = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage *backButtonImage = [[UIImage imageNamed:@"back"]imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[self.backButton setImage:backButtonImage forState:UIControlStateNormal];
self.backButton.tintColor = [UIColor myCustomColor];