Does a grouped UITableView give its backgroundColor to its cells?
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:UITableViewStyleGroupe开发者_StackOverflowd];
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?
override tableView:willDisplayCell:forRowAtIndexPath: and give the cell a transparent background
精彩评论