[TIMOB-12646] iOS: TableViewRow selection causes child view's backgroundColor to disappear
GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2014-09-17T18:32:05.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | defect, ios |
Reporter | Bart Seaman |
Assignee | Pedro Enrique |
Created | 2012-11-08T20:21:48.000+0000 |
Updated | 2017-03-22T21:35:39.000+0000 |
Description
Platform: iOS
Device: iOS Simulator 6.0 & iPod Touch (4th gen, software version 6.0.1)
Repro:
1. Create a TableView
2. Create a TableViewRow
3. Create a View with a backgroundColor
4. Add the view to the row
5. Add the row to the table
6. Tap and hold on the row
Result: The row's selectedBackgroundColor becomes visible and the view's backgroundColor becomes transparent
Expected: The row's selectedBackgroundColor becomes visible and the view's backgroundColor remains visible
Additional Notes:
1. If the view inside of the row has children, they are still displayed. Only the view's backgroundColor is affected.
2. Setting the row's selectionStyle to NONE prevents the backgroundColor of the view from disappearing.
Attachments
Is this only with Alloy? Does this happen in traditional Titanium development as well?
This behavior occurs in traditional development, too.
In studio, create a new Titanium Classic Project using the Single Window Application template. Replace the generated FirstView.js with the attached.
Assigning to Ingo so that the platform team can assess it, since this is not an Alloy-specific issue.
Is time to fix the issue otherwise is impossible to use view with background color without dissapearing. I am adding next example, borderColor does work ,but backgroundColor doesn't...
Same problem with Version 3.1.3 GA (iOS7)
Still not solved - in 3.2
This is Apple's behavior. When a table view row is selected, it will iterate through it's subviews, or children, and set their background color's alpha to transparent. When deselected, it will iterate through it's subviews again reseting their background color's alpha to whatever it was. In other words, the children's background color becomes transparent on row selection, and this is done by the system.
I was able to reproduce the issue natively in Xcode 5.1.1 with iphone 5 (7.0.2); see monkey.zip attachment
This is native behavior, and there will be no fix. In general, we try not to work around native behavior as the fix can be fragile. For those interested in addressing the issue, there is a work around that you can apply to your own SDK. We have created a PR that shows what changes need to be made against the 3.4.0 version of the SDK: https://github.com/appcelerator/titanium_mobile/pull/6121. You will need to pull in this PR and build a version of the SDK as explained in the documentation. This can then be used by appending the following property to Titanium.UI.createTableViewRow.
There is a pretty simple work around where you use backgroundImage instead.
Closing ticket as "Won't Fix".