user2720097
user2720097

Reputation: 509

change image of UITableViewCellEditingStyleDelete

Somebody know whats the way to change the background image of the minus button of UITable cell,

enter image description here

I need to change this button enter image description here to something like enter image description here

because if you change between iOS6 and iOS7 this button changed.

Upvotes: 2

Views: 727

Answers (1)

Ashish Kakkad
Ashish Kakkad

Reputation: 23882

Hope this will help you

- (void)willTransitionToState:(UITableViewCellStateMask)state
    {
        [super willTransitionToState:state];
        if ((state & UITableViewCellStateShowingDeleteConfirmationMask) == UITableViewCellStateShowingDeleteConfirmationMask)
        {
            for (UIView *subview in self.subviews)
            {
                if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"])
                {
                    UIImageView *deleteBtn = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 64, 33)];
                    [deleteBtn setImage:[UIImage imageNamed:@"deleteNewImg.png"]];
                    [[subview.subviews objectAtIndex:0] addSubview:deleteBtn];
                }
            }
        }
    }

Upvotes: 1

Related Questions