iOS SDK 6 and grouped tableview transparancy/background color failure

You must Login before you can answer or comment on any questions.

There appears to be a bug with iOS SDK 6 and TableViews with GROUPED styling.

It seems to ignore background color/image settings.

Replicated Bug

I tried with the latest CI build, and it still occurs:

[INFO] One moment, building ...
[INFO] Titanium SDK version: 2.1.3 (09/18/12 17:01 23401a3)
[INFO] iPhone Device family: universal
[INFO] iPhone SDK version: 6.0
[INFO] iPhone simulated device: iphone
[INFO] Performing full rebuild. This will take a little bit. Hold tight...
[INFO] Minimum iOS version: 4.0
[INFO] Performing clean build
[INFO] Compiling localization files
Replicating:

  1. Create a new single window project
  2. Add the following code to "Resources/ui/common/FirstView.js" right before the return self;
    var data = [];
            var settingselements = {};
     
            settingselements.passwordRow = Ti.UI.createTableViewRow({
                height:50,
                borderColor: '#000000',
                borderWidth: 2,
            });
     
     
            settingselements.password = Titanium.UI.createTextField({
                color:'#000000',
                height:35,
                top:10,
                left:10,
                width:250,
                hintText:'New Password',
                autocorrect: false,
                passwordMask: true,
                borderStyle:Titanium.UI.INPUT_BORDERSTYLE_NONE
            });     
     
            settingselements.passwordRow.add(settingselements.password);
     
            settingselements.passwordRow.selectionStyle = Ti.UI.iPhone.TableViewCellSelectionStyle.NONE;
     
     
            data.push(settingselements.passwordRow);
     
            settingselements.passwordverifyRow = Ti.UI.createTableViewRow({
                height:50,
                borderColor: '#000000',
                borderWidth: 2
            });
     
     
            settingselements.passwordverify = Titanium.UI.createTextField({
                color:'#000000',
                height:35,
                top:10,
                left:10,
                width:250,
                hintText:'Verify Password',
                passwordMask: true,
                borderStyle:Titanium.UI.INPUT_BORDERSTYLE_NONE
            });     
     
            settingselements.password.addEventListener('return',function(){
                settingselements.passwordverify.focus();
            });
     
     
            settingselements.passwordverifyRow.selectionStyle = Ti.UI.iPhone.TableViewCellSelectionStyle.NONE;
            settingselements.passwordverifyRow.add(settingselements.passwordverify);
     
            data.push(settingselements.passwordverifyRow);
     
            // the password change box containing above rows
     
     
            var newpasswordbox = Ti.UI.createTableView({
                backgroundColor:'transparent',
                rowBackgroundColor:'#eee',
                data:data,
                style: Titanium.UI.iPhone.TableViewStyle.GROUPED,
                width: 300,
                top: 20,
                left: 10,
                height: 130,
                scrollable: false
            })
     
            self.add(newpasswordbox);

I've tried setting the backgroundColor to a color ( 'white' ) and hex ( '#FFFFFF' ) , still no go.

I've tried directly setting it ( newpasswordbox.backgroundColor = 'transparent'; ) and using the method ( newpasswordbox.setBackgroundColor('#FFFFFF'); ) Still nothing...

Any ideas?

— asked 9 months ago by Peter Azuolas
2 Comments
  • Peter I had exactly the same problem and I could not get around it. Even the kitchen sink example which shows custom rows displays the same horrible pin stripe background. Its certainly a bug. I ended up creating custom section views to make my screen look half reasonable but it was not a solution.

    — commented 9 months ago by Steven Salmon

  • I'm having the same issue here after getting today's Xcode update

    — commented 9 months ago by David Murray

5 Answers

Accepted Answer

This error is waiting pull request no github https://jira.appcelerator.org/browse/TIMOB-10998.

I manually change the code and work's

— answered 9 months ago by Pedro Brasileiro
answer permalink
9 Comments
  • Do you have any pointers as to where we can manually change the code?

    — commented 9 months ago by Joshua Nicholson

  • This is a sample

    — commented 9 months ago by Pedro Brasileiro

  • Thanks for the quick response, Pedro. While waiting for your response, I went and changed the source in a different spot. (I posted it as an answer). Not sure which way is better.

    — commented 9 months ago by Joshua Nicholson

  • Show 6 more comments

Per @pedro, i modified the Ti SDK source to fix this bug (at least for now). I guess this bug was also present in earlier versions of iOS for iPad's only? I say this because the source code has a fix for this bug but only fixes for iPad. I edited the code to fix on any device type. Here is the code and fix:

In TiUITableView.m in the method setBackgroundColor:onTable: (arround line 347).

if ([table style] == UITableViewStyleGrouped/* && [TiUtils isIPad]*/) {
I just commented out the check for iPad. I confirmed it works in Simulator and device (ios 6)

Arrrgh! Why, oh why, oh why, do I insist on messing with release candidates??? Can't wait for a permanent fix!

I have a similar problem, but with different symptoms: I have a straightforward table view with TableViewStyle.GROUPED and I expect it to show with the default striped background. This does work on the iphone (simulator and device) but not on the iPad (simulator and device). On the iPad the background is always black. I tried 2.1.2GA and the fix mentioned above.

Any suggestions anyone?

— answered 8 months ago by Martin van Mierloo
answer permalink
4 Comments
  • Hi Martin. What iOS are you targeting? Because the recent bug discussed here effects iOS6. Also, do you want ALL of your tableviews to be the default stripes background? Or only certain ones? The fix discussed here pretty much applies the same 'fix' to all tableviews in the application.

    Just trying to get some more info before trying to help with an answer.

    — commented 8 months ago by Joshua Nicholson

  • I'm building for IOS6. Xcode 4.5, Titanium SDK 2.1.3.v20120915120319

    Here's a small snippet including 2 screenshots for iphone and iPad.

    var win = Ti.UI.createWindow();
    var section = Titanium.UI.createTableViewSection({headerTitle:'Section 1'});
     
    var data = [];
     
    var row1 = Titanium.UI.createTableViewRow({
        title:'row 1' ,
        hasChild: true
    });
    var row2 = Titanium.UI.createTableViewRow({
        title:'row 2' ,
        hasChild: true
    });
     
     
    section.add(row1);
    section.add(row2);
    data.push(section); 
     
    var table = Titanium.UI.createTableView({
        data : data,
        style: Titanium.UI.iPhone.TableViewStyle.GROUPED
    });
    win.add(table); 
    win.open();
    result in iphone simulator: http://i.imgur.com/pA91Q.png

    result in ipad simulator: http://i.imgur.com/oEiq0.png

    You can see that the ipad background is missing, so this seems like a bug.

    — commented 8 months ago by Martin van Mierloo

  • I just tried this with 2.1.3 RC2 and the behavior is more consistent, but still not working: both simulator now show a black background and not the default striped background.

    — commented 8 months ago by Martin van Mierloo

  • Show 1 more comment

Your Answer

Think you can help? Login to answer this question!