Wenn ich die UITableViewCells backgroundColor
auf eine halbtransparente Farbe einstelle, sieht es gut aus, aber die Farbe bedeckt nicht die gesamte Zelle.UITableViewCell transparenter Hintergrund (einschließlich imageView/accessoryView)
Die Gegend um das imageView
und accessoryView
kommen auf, als [UIColor clearColor]
...
ich die cell.accessoryView.backgroundColor
und cell.imageView.backgroundColor
Einstellung versucht haben ausdrücklich die gleiche Farbe wie die Zelle backgroundColor
, aber es ist funktioniert nicht. Es wird ein kleines Kästchen um das Symbol gelegt, aber es wird nicht erweitert, um die linke Kante zu füllen. Der rechte Rand scheint davon nicht betroffen zu sein.
Wie kann ich das beheben?
EDIT: Hier ist der rohe Tabellenzelle Code:
- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
cell.opaque = NO;
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.backgroundColor = [UIColor colorWithRed:.1 green:.1 blue:.1 alpha:.4];
cell.textColor = [UIColor whiteColor];
}
cell.imageView.image = [icons objectAtIndex:indexPath.row];
cell.textLabel.text = [items objectAtIndex:indexPath.row];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
eigentlich musste ich noch 1 Sache machen. Die cell.textLabel.backgroundColor musste * NACH * der Hintergrundfarbe der Zelle gesetzt werden. Ich habe keine Ahnung, warum ich das tun muss, aber jetzt funktioniert es. Danke Mike! –