Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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).

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];

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top