Use a pattern background (background-grouped-table) for a view
With the iPhone SDK I can set the background of a view to the striped pattern used by the grouped table view using:
self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
How can I accomplish the same with Titanium Mobile?
4 Answers
-
Accepted Answer
backgroundColor = 'stripped'
-
Hi,
I think I'm a little bit late, but maybe it is a help to others as well:
var tbl = Ti.UI.createTableView({ style: Ti.UI.iPhone.TableViewStyle.GROUPED });
This way you will get a default backgrounded table view.
-
The solution finally dawned on me. Take your iphone simulator, and carefully cut a horizontal stripe of groupTableViewBackgroundColor, completely, from left to right (it's done with the cmd+shift+4, that lets you cut part of the screen, if u are on mac)
Then process it in an graphic editor to receive an image of width 320 and of any small height, that image will contain gray stripes only, of the type of groupTableViewBackgroundColor.
Then set this image as backgroundImage for Titanium.UI.currentWindow or any other view you want, or you can set the backgroundImage of a window, and the rest of views (like scrollview) will have transparent background color.
Yes, the image pattern cannot be tiled, but it STRETCHES vertically and becomes just as good as the tableview's background, because there is no special design in that color, just vertical stripes in shades of gray. :)
-
The method you use depends on the hard graphic image you created.
Is there a way to do this programitically?If the iOS change with a different pattern background, then you hard coded background will not match… you know what I mean?