[TIMOB-2178] Black does not work in a background gradient iOS
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Trivial |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:58:19.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.6.0 M06 |
Components | iOS |
Labels | defect, gradient, ios, iphone, release-1.6.0 |
Reporter | ctredway |
Assignee | Blain Hamon |
Created | 2011-04-15T03:12:51.000+0000 |
Updated | 2011-04-17T01:58:19.000+0000 |
Description
Running on the iphone, setting a background gradient color to black does not work, Setting it to 000001 does work however.
Code:
var win = Ti.UI.currentWindow;
var view = Titanium.UI.createView({
top:0,
left:0,
//height:height,
//width:width,
backgroundGradient:{
type:'linear',
colors:[{color:'#50FFFF',position:0.0},{color:'#000000',position:1.0}]
}
});
win.add(view);
HD ticket
http://developer.appcelerator.com/helpdesk/view/51211">http://developer.appcelerator.com/helpdesk/view/51211
Apparently the reason why this isn't working is because [UIColor blackColor]'s color space model is kCGColorSpaceModelMonochrome.
CAGradientLayer does not accept colors that are in the kCGColorSpaceMonochrome color space model.
The fix for this is to check if the color space is kcGColorSpaceModelMonochrome, and if it is, re-assign the gradient's color to the RGB representation of the color by using UIColor's colorWithRed:green:blue:alpha: method.
Here's a screenshot of it in action:
http://cl.ly/3u282l072k3g1O1F1x01">http://cl.ly/3u282l072k3g1O1F1x01
(from [e2c1e33e2196f82f790db9282ce9612fd24e2b75]) [#2178 state:fixed-in-qa] [#2837 state:fixed-in-qa] Updating formatting for TiGradient to house style. Actual bug fixes were done by Jacob. See https://github.com/appcelerator/titanium_mobile/pull/58">https://github.com/appcelerator/titanium_mobile/pull/58 https://github.com/appcelerator/titanium_mobile/commit/e2c1e33e2196f82f790db9282ce9612fd24e2b75"> https://github.com/appcelerator/titanium_mobile/commit/e2c1e33e2196...
Added test to Integrity, validated fix.