Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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?

— asked May 24th 2010 by Donald Hughes
  • background
  • iphone
  • pattern

4 Answers

  • Accepted Answer

    backgroundColor = 'stripped'

    — answered January 4th 2011 by dick amin
    1 Comment
    • This only works for iPhone and not iPad?

      — commented February 19th 2012 by Danny Pham
  • 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.

    — answered November 16th 2010 by Adam Wallner
  • 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. :)

    — answered July 29th 2010 by Anna Kozynenko
  • 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?

    — answered July 29th 2010 by Peter Lum
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.