[TIMOB-16547] iOS: Add ability to set color and backgroundColor for Picker control
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2016-02-10T18:05:46.000+0000 |
| Affected Version/s | Release 5.1.2 |
| Fix Version/s | Release 5.2.0 |
| Components | TiAPI |
| Labels | backgroundColor, color, ios, picker, qe-5.2.0 |
| Reporter | Ed |
| Assignee | Hans Knöchel |
| Created | 2014-03-02T19:39:55.000+0000 |
| Updated | 2016-02-10T23:39:38.000+0000 |
Description
The backgroundColor of the Picker control on iOS is hardcoded to white:
https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUIPicker.m#L64
This becomes a problem when designing dark themed apps, that would need to reverse the colors of the picker (light colored text over dark background).
Ideally, color and backgroundColor should be exposed through properties of the Ti Picker control.
Attachments
| File | Date | Size |
|---|---|---|
| Simulator Screen Shot 09.02.2016, 17.05.18.png | 2016-02-09T16:11:57.000+0000 | 56166 |
| white_picker.jpg | 2014-03-02T19:39:55.000+0000 | 14644 |
iOS Human Interface Guidelins does not provide much direction about the color or backgroundColor for the picker control except the following statement: - Uses dark text to display the current value in the middle of the view (https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/MobileHIG.pdf) Moving this feature request to engineering for further evaluation and prioritization.
iOS7+ supports the backgroundColor-property which has a default value of UIColor().clearColor. Titanium default is UIColor().whiteColor. Will resolve this asap!
**Please do not merge, yet** The following PR includes support for setting the
backgroundColorproperty of the picker, the color of normal picker cells itself can be set inside their cells, a tinting for time- and datetime-pickers is now possible using thedateTimeColorproperty. PR (master): https://github.com/appcelerator/titanium_mobile/pull/7690 PR (5_2_X): https://github.com/appcelerator/titanium_mobile/pull/7698 Demo:Result: http://abload.de/img/simulatorscreenshot090rkkh.pngvar win = Ti.UI.createWindow({ backgroundColor : "#fff" }); var picker = Ti.UI.createPicker({ backgroundColor: "#000", dateTimeColor: "#fff", type: Ti.UI.PICKER_TYPE_DATE_AND_TIME }); win.add(picker); win.open();[~hansknoechel] Is this feature only for
Ti.UI.PICKER_TYPE_DATE_AND_TIMEor will it work with the custom pickers tooAs mentioned above, iOS only allows to tint time- and datetime-pickers. Normal pickers can add a
Ti.UI.Labelwith a custom color.