iphonexcodegrouped-table

Is it possible to set color to the table in a grouped table


I know how to set color to a plain table. If shifting to a grouped table the background color will also shift and be in the background outside the table itself. Is it possible to set color to the table also. I.e. one color for the outside area and another for the table?


Solution

  • This can be done by adding a few lines of code.

    For using image as background,

    tableView.opaque = NO;
    [tableView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"image.png"]]];
    

    For using single color you can use,

    tableView.opaque = NO;
        [tableView setBackgroundColor:[UIColor blueColor]]; 
    

    For more detail, You can look up this tutorial.