Search code examples
iosios6

How to set up basic grey lined background in my iOS app?


Possible Duplicate:
How can I get the pinstripe background to show?

I like the background in default iOS apps - the grey background with vertical lines. But I can't find it in any of the background settings for views. Is it just an image? Or is there any way to access it to use in my apps?


Solution

  • I believe you're looking for this:

    + (UIColor *)groupTableViewBackgroundColor
    

    Further info here:

    http://developer.apple.com/library/ios/#documentation/uikit/reference/UIColor_Class/Reference/Reference.html

    (see System Colors)

    Example usage:

    myView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    

    Edit:

    Okay, seems Apple have deprecated the use of the above call, as per the UIInterface.h file:

    // Group style table view backgrounds can no longer be represented by a simple color.

    // If you want to have a background in your own view that looks like the table view background,

    // then you should create an empty table view and place it behind your content.

    + (UIColor *)groupTableViewBackgroundColor; // This method will be deprecated during the 6.0 seed program
    

    Looks like you'll have to do as Apple have suggested in their comments above.