PDA

View Full Version : PNG transparency in TableCellView not working




chinnybloke
Aug 10, 2010, 07:27 AM
Hello,

I have a table view cell with 3 subviews added, 2 labels and an imageview. Under the emulator the image view correctly shows png transparency in the cell, but when I upload the app to my ipodtouch for testing, the png areas that should be transparent show as black. Is this a bug or something I am missing which is overriding this?

My code is:
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
{
// Layout cellstyle
messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 10, 240, 50)];

// Setup layout
UIImage *messageImage = [UIImage imageNamed:@"unread.png"];
statusImageView = [[UIImageView alloc] initWithImage:messageImage];
statusImageView.frame = CGRectMake(250, 40, 35, 35);
messageLabel.font = [UIFont fontWithName:@"Helvetica" size:15];
messageLabel.numberOfLines = 3;

[self.contentView addSubview:titleLabel];
[self.contentView addSubview:messageLabel];
[self.contentView addSubview:statusImageView];
}

return self;
}

Thanks in advance



robbieduncan
Aug 10, 2010, 07:38 AM
Try setting the background colour of statusImageView to be transparent. Most likely it's set to black and that's what you are seeing.

chinnybloke
Aug 11, 2010, 03:19 PM
Try setting the background colour of statusImageView to be transparent. Most likely it's set to black and that's what you are seeing.

Still no joy. I've added statusImageView.backgroundColor = [UIColor clearColor]; and only on the device does it still show black where the transparency should be. Emulator on iMac shows it working