A quick question, I want to change the color of the UITableViewCellAccessoryDisclosureIndicator
(the arrow on the right side of tableView
) from default gray to white color.
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
For others who are still stumbling upon this question, here's how to do it programmatically.
Create a UIView subclass, and override drawRect:
with the following:
#define PADDING 4.f //give the canvas some padding so the ends and joints of the lines can be drawn with a mitered joint
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(context, [UIColor grayColor].CGColor);
CGContextSetLineWidth(context, 3.f);
CGContextSetLineJoin(context, kCGLineJoinMiter);
CGContextMoveToPoint(context, PADDING, PADDING);
CGContextAddLineToPoint(context, self.frame.size.width - PADDING, self.frame.size.height/2);
CGContextAddLineToPoint(context, PADDING, self.frame.size.height - PADDING);
CGContextStrokePath(context);
}
This draws a stock indicator arrow. From here you can change the color, line width, etc.
To add the indicator view to your cell:
#define ACCESSORY_WIDTH 13.f
#define ACCESSORY_HEIGHT 18.f
cell.accessoryView = [[AccessoryIndicatorView alloc] initWithFrame:CGRectMake(self.frame.size.width - ACCESSORY_WIDTH - CELL_PADDING, self.frame.size.height/2 - ACCESSORY_HEIGHT/2, ACCESSORY_WIDTH, ACCESSORY_HEIGHT)];
You'll find including MSCellAccessory will help in a lot of different ways including changing the color of the UITableViewCellAccessoryDetailDisclosureButton
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With