views:

4785

answers:

5

Hi I wrote this

cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

in this method

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;

but I can only see it when I select that cell otherwise it's not visible.and it work perfectly when background is white. I am sure that I need to set a property, but I don't know which property I need to change to make this thing work.

thanks in advance.

cheers.

+3  A: 

It would appear that the disclosure indicator is a gray, high-alpha image, so overlaying that over a black background makes it invisible. If you want to do this, you'll need to add your own UIImageView to the cell's contentView.

Ben Gottlieb
+2  A: 

I ran into this same issue, and just create a UIImageView out of a UIView’s imageWithName @"AccDisclosure.png" using the following hastily mocked-up graphic which you're free to copy: http://thinkingman.com/db/downloads/AccDisclosure.png (if you just click that link, you'll probably see nothing, as it's a white image with a transparent background, but if you save it and view against a dark background, you'll see the alpha).

Thinkingman.com
A: 

Thinkingman,

Thank you for AccDisclosure.png, just what I needed. I cropped it in Gimp from your 30x30 to 10x13, for better alignement with the standard UITableViewCellAccessoryDisclosureIndicator.

rudifa
A: 

The following code allows me to set the background color of the arrow tip in a table row.

@property (nonatomic,retain) UILabel *backgroundLabel;

UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero]; label.backgroundColor = [UIColor orangeColor]; self.backgroundLabel = label; [self.contentView addSubview:label]; [label release];

CGRect labelRect = CGRectOffset(contentRect,0, 0); labelRect.size.height = contentRect.size.height - 1; // show white line labelRect.size.width = contentRect.size.width + 50; // cover arrow tip background backgroundLabel.frame = labelRect;
backgroundLabel.highlightedTextColor = [UIColor whiteColor];

John Dell'Aera
A: 

I made a solution where I added an ImageView with addSubView in the normal fashion, with an image that was not black (in my case, a grey filled circle) at the position where the accessory appears.

That allows the arrow to be seen and still have a dark/black table cell background color.

Maybe not the most kosher solution, but it makes the arrow visible, and I get notified of accessory clicks without subclassing or writing lots of code.

Henrik Erlandsson