Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12646] iOS: TableViewRow selection causes child view's backgroundColor to disappear

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionWon't Fix
Resolution Date2014-09-17T18:32:05.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsdefect, ios
ReporterBart Seaman
AssigneePedro Enrique
Created2012-11-08T20:21:48.000+0000
Updated2017-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

FileDateSize
FirstView.js2013-02-07T01:11:52.000+0000561
monkey.zip2014-08-14T18:59:34.000+000040827

Comments

  1. Tony Lukasavage 2013-02-06

    Is this only with Alloy? Does this happen in traditional Titanium development as well?
  2. Bart Seaman 2013-02-07

    This behavior occurs in traditional development, too.
  3. Bart Seaman 2013-02-07

    In studio, create a new Titanium Classic Project using the Single Window Application template. Replace the generated FirstView.js with the attached.
  4. Tony Lukasavage 2013-02-07

    Assigning to Ingo so that the platform team can assess it, since this is not an Alloy-specific issue.
  5. Matej 2013-08-14

    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...
     
       var win = Titanium.UI.createWindow();
        
       var row = Ti.UI.createTableViewRow({
       	width: Ti.UI.FILL, height: Ti.UI.FILL,
       	backgroundColor: "white"
       });
       
       var view = Ti.UI.createView({
       	width: 33, height: 33,
       	borderWidth: 3,
       	borderColor: "blue",
       	backgroundColor: "red"
       });
       
       row.add(view);
       
        
       var tableView = Titanium.UI.createTableView({
       	data: [row]
       });
       
       win.add(tableView);
       win.open();
       
  6. Thomas Weber 2013-10-06

    Same problem with Version 3.1.3 GA (iOS7)
  7. Nico Barelmann 2014-01-30

    Still not solved - in 3.2
  8. Pedro Enrique 2014-08-14

    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.
  9. Wilson Luu 2014-08-14

    I was able to reproduce the issue natively in Xcode 5.1.1 with iphone 5 (7.0.2); see monkey.zip attachment
  10. Muhammad Dadu 2014-09-17

    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.
        selectedBackgroundNative: false
        
  11. Bert Grantges 2015-10-08

    There is a pretty simple work around where you use backgroundImage instead.
  12. Lee Morris 2017-03-22

    Closing ticket as "Won't Fix".

JSON Source