SeaJelly
SeaJelly

Reputation: 1746

UITableView edit mode - customize color of minus sign delete button

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.

Upvotes: 9

Views: 1198

Answers (1)

Noe Miranda Franco
Noe Miranda Franco

Reputation: 83

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++;
        }
    }
}}

Upvotes: 0

Related Questions