iPhone change uitableview grouped style background texture's color

Discussion in 'iOS Programming' started by isparkdev, Jun 1, 2009.

  1. isparkdev macrumors newbie

    Joined:
    Jun 1, 2009
    #1
    Hi,
    Is it possible to change background color of uitableview (style grouped) while still preserving the texture of vertical lines.
    If i change background color the texture is lost & i get a plain background.
     
  2. jnic macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #2
    Code:
    [UIColor [URL="http://developer.apple.com/iphone/library/documentation/uikit/reference/UIColor_Class/Reference/Reference.html#//apple_ref/occ/clm/UIColor/groupTableViewBackgroundColor"]groupTableViewBackgroundColor[/URL]]
     
  3. johnnyjibbs macrumors 68030

    johnnyjibbs

    Joined:
    Sep 18, 2003
    Location:
    London, UK
    #3
    The grouped table view background colour is actually a pattern. If you want to create your own custom version of the default pattern you could capture a small 'tile' (for this pattern the smallest possible tile would be two columns wide, 1 pixel down) and then open it up in a paint program and change the colours to whatever you want.

    Then create your own colour using the new pattern:

    Code:
    tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"mypattern.png"]];
    
    (Note that UIImage's imageNamed: method is pure evil but on an image size of about 4 x 1 pixels it will not cause you any memory issues).
     

Share This Page