8

Is there a way to customize the color of the minus sign delete button when a UITableView is in edit mode? Designer needs it to be a deeper red to be consistent with our app's color scheme. Please note that I am talking about the circle minus sign delete icon on the left, not the delete confirmation buttons on the right:

enter image description here

SO posts I have found such as this one are all about customizing the delete confirmation buttons on the right hand side.

Community
  • 1
  • 1
SeaJelly
  • 1,738
  • 1
  • 15
  • 30

1 Answers1

0

this function works for me, just put it before return the cell in cellForRowAtIndexPath table view delegate method:

+(void) setImageToDeleteBtnInCell:(UITableViewCell*) cell image:(UIImage*) image{
for (UIView *subv in cell.subviews){
    if ([NSStringFromClass([subv class]) isEqualToString:@"UITableViewCellEditControl"]) {
        int i = 0;
        for (UIView *imgV in subv.subviews){
            if (i == 1){
                if([imgV isKindOfClass:[UIImageView class]]){

                    ((UIImageView*) imgV).image = image;
                    //imgV.tintColor = [ObjcThemeConnector getMainColor];
                }
            }
            i++;
        }
    }
}}
  • What about the size of the image view? If I pass an image that doesn't have the exact expected size, the frame takes the size of the image and it's not possible to resize it, for some reason. – User May 26 '18 at 15:49