0
我有我的行项目的UITableView图像暗背景被初始化为默认的UITableViewCell(所有者文件是委托并表的数据源):在默认情况下的UITableViewCell
- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
[cell setSelectionStyle:UITableViewCellSelectionStyleGray];
switch (indexPath.row) {
case 0:
cell.imageView.image = [UIImage imageNamed:@"icon_facebook.png"];
cell.textLabel.text = kShareFacebook;
break;
case 1:
cell.imageView.image = [UIImage imageNamed:@"icon_twitter.png"];
cell.textLabel.text = kShareTwitter;
break;
case 2:
cell.imageView.image = [UIImage imageNamed:@"icon_clipboard.png"];
cell.textLabel.text = kShareClipboard;
break;
default:
break;
}
return cell;
}
这一切工作正常然而当显示表,图像被显示在较暗的背景和有沿着行的右边缘较暗的余量,如可在此图像中可以看出: 我试图使用以清除该背景一些/所有的组合:
[cell setBackgroundColor:[UIColor whiteColor]];
[cell.imageView setBackgroundColor:[UIColor whiteColor]];
[cell setIndentationLevel:1];
[cell setOpaque:YES];
但是这没有帮助。我如何摆脱黑暗的背景,让整个细胞出现在白色背景上?
您是否使用IB来设置UITableView? – Mutix 2011-12-15 10:30:27