iDevGames Forums
Transparent background for UITableViewCellAccessoryDetailDisclosureButton - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: Transparent background for UITableViewCellAccessoryDetailDisclosureButton (/thread-8096.html)



Transparent background for UITableViewCellAccessoryDetailDisclosureButton - Toontingy - Sep 10, 2010 05:04 PM

I have a custom table cell, i set the accessory type to the disclosure button and set the background color, but the background still seems to be white.
Code:
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MonsterCellIdentifier] autorelease];
cell.contentView.backgroundColor = [UIColor colorWithRed:116.0/255.0 green:134.0/255.0 blue:56.0/255.0 alpha:1.0];
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
cell.accessoryView.backgroundColor = cell.contentView.backgroundColor;

Why doesnt the disclosure button take on the background color of the accessory?


RE: Transparent background for UITableViewCellAccessoryDetailDisclosureButton - longjumper - Sep 10, 2010 06:12 PM

The cell's background color gets set to white as it is being displayed - you can override this by implementing tableView:willDisplayCell:forRowAtIndexPath: in your delegate and changing the background color there.


RE: Transparent background for UITableViewCellAccessoryDetailDisclosureButton - Toontingy - Sep 11, 2010 04:52 AM

That changed the background color of the cell, but the accessory view still wasnt affected. So I instead created my own accessory view, created my own button to get the desired effect.