How can I change the image for the delete button in a table view cell?
I mean the red circle button on the left side:
How can I change the image for the delete button in a table view cell?
I mean the red circle button on the left side:
Override the following in your UITableViewCell
subclass:
- (void)willTransitionToState:(UITableViewCellStateMask)state
{
[super willTransitionToState:state];
if(state == UITableViewCellStateShowingEditControlMask)
{
for (UIView *v in self.subviews) {
if ([NSStringFromClass([v class]) isEqualToString:@"UITableViewCellEditControl"]) {
UIImageView *customButton = [[UIImageView alloc]initWithFrame:v.bounds];
[customButton setImage:[UIImage imageNamed:@"delete.png"]];
[v addSubview:customButton];
[v bringSubviewToFront:customButton];
}
}
}
}
You can play with the subviews and the states to achieve your preferred result.