Allow Changing Tint Color for Different UIButton States

Originator:butler.grant.j
Number:rdar://30783780 Date Originated:01-Mar-2017 12:14 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:10.2
Classification:Enhancement Reproducible:Always
 
Area:
UIKit

Summary:
Sometimes our designs dictate that an image have a different color for different states. This is easy to achieve when you have each of those images pre-rendered with the color applied to it, but when you're using template images, there doesn't appear to be a way to make this happen without having to either tint the image at runtime, or just not use template images.

Steps to Reproduce:
1. Have a template image.
2. Set the image on a button.
3. Try to have a different tint color for different states to change the color of the image when the button changes state.

Expected Results:
An API exists that allows me do to this.

Actual Results:
No API exists. I have to implement my own `TintedButton` subclass of `UIButton` to support this behavior, and hope that my implementation of how to interpret `UIButton.state` matches up with how `UIButton` uses that value to determine which value to use for the other `-set<Thing>:forState:` APIs.

Version:
iOS 10.2

Notes:


Configuration:
All iOS Devices

Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!