【发布时间】:2011-01-31 16:43:44
【问题描述】:
我想要一个 UITableView 的背景图片
假设您已经像这样初始化任何分组表:
- (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;
}
这导致 tableView 具有背景图像,而且每个单元格都具有图像的最下部。
我想是这样的,因为 UITableViewCell 应该具有与 UITableView 相同的背景颜色。它适用于颜色,但对于图像,情况就完全不同了。
有没有办法告诉 UITableViewCell 不要使用这张图片?
【问题讨论】:
标签: image uitableview colors background