I add UIView with background image(that has transparent parts) into the UITableViewCell. At first everything looks perfect, but after deselecting row, background of my UIView looses transparency.
step 1
http://img29.imageshack.us/img29/1842/screenshot20110910at409.png
step 2
http://img41.imageshack.us/img41/1842/screenshot20110910at409.png
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
UIView *priceView = [[UIView alloc] init];
priceView.frame = CGRectMake(250, 10, 40, 21);
priceView.backgroundColor = [UIColor colorWithPatternImage:[ UIImage imageNamed:@"priceBG.png" ]];
priceView.opaque = NO;
[priceView.layer setOpaque:NO];
[cell addSubview:priceView];
[priceView release];
return cell;
Use a UIImageView instead and add it to the cell’s contentView: