Get rid of the UITableViewCell custom accessory fill

I have a table cell with a custom one accessoryView, but it seems that the default method creates a 15-point field on the right side. I want to get rid of him.

I can achieve the desired effect by overriding layoutSubviews, but this breaks the animation of the editing mode (the accessory no longer inserts / is removed).

What is the best way to do this?

+4
source share
1 answer

Add subview instead of accessories

UIButton *deleteBtn = [UIButton  buttonWithType:UIButtonTypeCustom];
deleteBtn.frame = CGRectMake(cell.contentView.frame.size.width-55, 2, 50, 50);
[deleteBtn setBackgroundImage:[UIImage imageNamed:@"trash.png"] 
                     forState:UIControlStateNormal];
deleteBtn.backgroundColor = [UIColor clearColor];
//deleteBtn.alpha = 0.5;
deleteBtn.tag = indexPath.row;
[deleteBtn addTarget:self action:@selector(numberDeleteConfirm:) 
    forControlEvents:UIControlEventTouchUpInside];

[cell.contentView addSubview:deleteBtn];
0
source

All Articles