Problem
When applying a semi opaque backgroundColor to a tableViewRow in conjunction with the title attribute, the backgroundColor is not rendered properly.
Actual
The title area of the row is applied the same backgroundColor as the row, resulting in a more opaque background. For example, if the color #50000000 is used, the table row background color is rendered 50% black, however the title area of the row is also rendered with 50% black background, resulting in a 75% black background due to the underlying row color.
Expected
The title area of a row should have no background color rendered to it.
Repro sequence
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
//
var win = Titanium.UI.createWindow({
title:'Tab 1',
});
var tbl = Ti.UI.createTableView()
win.add(tbl);
var tblData = [];
var row = Ti.UI.createTableViewRow({
title: 'testing 123',
backgroundColor: '#50000000'
});
tblData.push(row);
tbl.setData(tblData);
win.open();
Tested on
iOS 5.1 simulator
From the color section in the docs for on Titanium.UI:
"An additional alpha channel is supported as a prefix to the hex triplet. So, to make the purple-like color '#ff00ff' semi-opaque, you could use an alpha value of '55', giving, '#55ff00ff' or '#5f0f'."
Note: This is because the native built-in label is also getting the color. We need to reset the label to a fully clear background when the BG color is nonopaque.
Blain, what is the scenario where the label needs to inherit any background color? Shouldn't it always be fully clear?
The scenario is [performance](https://developer.apple.com/library/ios/documentation/2DDrawing/Conceptual/DrawingPrintingiOS/GraphicsDrawingOverview/GraphicsDrawingOverview.html#//apple_ref/doc/uid/TP40010156-CH14-SW30). Even natively, Apple stresses to avoid using clear (more specifically, opaque views are better) because then the graphics engine doesn't have to do a complex compositing, but can quickly [blit](https://en.wikipedia.org/wiki/Bit_blit) the pixmap onscreen without alphas or masking. a = b is a significantly faster operation than a = (1-x)*a + x*b.
https://github.com/appcelerator/titanium_mobile/pull/2817
Verified fix with: Titanium Studio, build: 2.1.2.201208201549 Titanium SDK:2.2.0.v20120824175712 Devices: Simulator 5.1 iPhone 4.3.5
Re-opening to edit label
Is this going to be re-closed now that the label's edited, or does there remain more work?
Seem as though this was inadvertently reopened. Closing once again
Reopeneing to add merge labels
Verified on: Titanium Studio: 2.1.2.201208301612 Titanium SDK: 2.1.3.v20120915120319 Device: iPad2 (v5.1)