There appears to be a bug with iOS SDK 6 and TableViews with GROUPED styling.
It seems to ignore background color/image settings.

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 filesReplicating:
- Create a new single window project
- 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?
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
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?
I would suggest that you log the bug in the community Appcelerator JIRA. Also as you know until Apple officially releases the OS, Appcelerator and all developers are under NDA.
Your Answer
Think you can help? Login to answer this question!