views:

49

answers:

2

Can someone please explain to me how I can make a uitableviewcellaccessorydisclosureindicator's background in a UITableViewCell transparent?

Right now I'm facing this problem:

alt text

A: 

In your UITableView's delegate, override the delegate method tableView:willDisplayCell:forRowAtIndexPath:. In there, set the cell's backgroundColor property to whatever color, and the accessory view's background color should match.

anshuchimala
A: 

Just found the answer. Turns out it was just 3 lines & having to define my own disclosure indicator .png image with a transparent background:

UITableViewCell *bgView = [[UITableViewCell alloc] initWithFrame:CGRectZero];
    bgView.backgroundColor=indexPath.row % 2? [UIColor colorWithRed:0.95 green:0.95 blue:0.95 alpha:1]: [UIColor whiteColor];
    bgView.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"disclosure.png"]];
    cell.backgroundView=bgView; 


    return cell;
dpigera