Archive for November, 2009

How To Add A Nice Background Image To Your Grouped Table View

without comments

http://howtomakeiphoneapps.com/2009/03/how-to-add-a-nice-background-image-to-your-grouped-table-view/

What you need to do is create a view with your background image and add that view to your app’s window. Then you must set the table view’s background color to “clearColor”.

Here is how you would do that from the app delegate:

UIView *backgroundView = [[UIView alloc] initWithFrame: window.frame];
backgroundView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"TableViewBackground.png"]];
[window addSubview:backgroundView];
[backgroundView release];

yourTableViewController = [[ATableViewController alloc] initWithStyle:UITableViewStyleGrouped];
yourTableViewController.view.backgroundColor = [UIColor clearColor];
[window addSubview:yourTableViewController.view];

[window makeKeyAndVisible];

yourTableViewController is declared at the top level of the app delegate and ATableViewController is a subclass of UITableViewController that simply displays the rows and sections in the example.

Written by grantmcinnes

November 3rd, 2009 at 11:17 am

Posted in iPhone