views:

25

answers:

1

I want to have a background Image for a UITableView

Imagine you have just any grouped table initialized like this:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

// Override point for customization after application launch
ImageTableViewController *vc = [[ImageTableViewController alloc] initWithStyle:UITableViewStyleGrouped];


 NSString *imagePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"BackgroundImage.jpg"];
 UIImage *image = [[[UIImage alloc] initWithContentsOfFile:imagePath] autorelease];
 vc.tableView.backgroundColor = [UIColor colorWithPatternImage:image];

 [window addSubview:vc.view];
    [window makeKeyAndVisible];

 return YES;
}

This results in the tableView having the backgrounImage, but also every cell having the lowermost part of the image.

I suppose this is the case, because UITableViewCell should have the same backgroundColor as UITableView. It would work good for colors, but with images the case is totally different.

Is there a way to tell UITableViewCell not to use this image?

A: 

override tableView:willDisplayCell:forRowAtIndexPath: and give the cell a transparent background

ManniAT
i need to set the background of the area outside the rounded rect. the backgroundColor property is dealing with the area inside of it.
Tomen
Sorry - I thought: Is there a way to tell UITableViewCell not to use this image - means you wanna get rid of the image in the cell
ManniAT