PNG transparency in TableCellView not working

Discussion in 'iOS Programming' started by chinnybloke, Aug 10, 2010.

  1. macrumors newbie

    Sep 6, 2008

    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
  2. Moderator emeritus


    Jul 24, 2002
    Try setting the background colour of statusImageView to be transparent. Most likely it's set to black and that's what you are seeing.
  3. thread starter macrumors newbie

    Sep 6, 2008
    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

Share This Page