I would like to set a custom image for all the UITableViewCell accessory view in my app. I've tried using this code:
[[UITableViewCell appearance] setAccessoryView:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"table-arrow.png"]]];
but it doesn't work.
Any idea?
Try creating custom appearance selector in UITableViewCell category. Here's an example implementation:
.h:
- (void)setAccessoryViewImage:(UIImage *)image UI_APPEARANCE_SELECTOR;
.m:
- (void)setAccessoryViewImage:(UIImage *)image {
self.accessoryView = [[UIImageView alloc] initWithImage:image];
}
And than you can configure all your cells using proxy object:
[[UITableViewCell appearance] setAccessoryViewImage:[UIImage imageNamed:@"table-arrow.png"]];