UIButton background color support

Originator:bruno
Number:rdar://48962167 Date Originated:2019-03-17
Status:Closed Resolved:Duplicate
Product:iOS + SDK Product Version:n/a
Classification:Suggestion Reproducible:n/a
 
Duplicate of 16300505.

Area:
UIKit

UIButton would benefit greatly from proper support for different background colors per UIControl state.

A very common design for buttons is a button with a background color. However, to do this properly, the background color should change or update itself according to the UIControl state of the button. For example, a button could have a blue background for its normal state and a grey background for its disabled state.

Currently, that's hard to do, causing developers to misuse the background image functionality instead, often causing some other things to work less well. 

Proposed API:

```
open func UIButton.setBackgroundColor(_ color: UIColor, for controlState: UIControl.State)
open func UIButton.backgroundColor(for controlState: UIControl.State)
```

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!