UITableViewCell delete button gets covered up

Solution 1:

I fixed this by finding the delete button view and bringing it to the front. I did this in layoutSubviews in a UITableViewCell subclass.

Here's a small bit of code that should give you an idea of how to do it:

- (void)layoutSubviews
{
    [super layoutSubviews];

    for (UIView *subview in self.subviews) {

        for (UIView *subview2 in subview.subviews) {

            if ([NSStringFromClass([subview2 class]) isEqualToString:@"UITableViewCellDeleteConfirmationView"]) { // move delete confirmation view

            [subview bringSubviewToFront:subview2];

        }
    }
}

Solution 2:

This is one of countless bugs in iOS 7.

For some reason the backgroundView is moved by iOS over the delete button. You can work-around this by subclassing your backgroundView and implementing the setFrame function of your derived view like this:

- (void)setFrame:(CGRect)frame
{
    if ([[[UIDevice currentDevice] systemVersion] compare:@"7.0" options:NSNumericSearch] != NSOrderedAscending) {
        // background view covers delete button on iOS 7 !?!
        [super setFrame:CGRectMake(0, frame.origin.y, frame.size.width, frame.size.height)];
    } else {
        [super setFrame:frame];
    }
}

As a side note: you can avoid the need for a separate sublayer by subclassing and implementing layerClass in your derived view:

+ (Class)layerClass
{
    return [CAGradientLayer class];
}

Solution 3:

- (void)layoutSubviews
{
    [super layoutSubviews];
    [self sendSubviewToBack:self.contentView];
}

Solution 4:

I was facing an issue where my UITableView was in editing mode and after deleting 2-3 rows I get message "attempting to set a swipe to delete cell when we already have one....that doesn't seem good" logged and then user Interaction on all cells except one cell gets disabled.

I solved this issue by

[myTableView setEditing:NO animated:NO];
[myTableView setEditing:YES animated:NO];

after each deletion.

This workaround worked in my case.

Solution 5:

You can use the colorWithPatternImage but for me it was easier to use the self.layer.content. for example :

cell.layer.contents = (id)[UIImage imageNamed:@"singleRow.png"].CGImage;

That way the image don't get stretched and it doesn't have to be in exact size. That way the delete button doesn't get covered up by the cell background image. By The Way: these custom gradient backgrounds don't seem to match up with the iOS 7 basic appearances, do you think that could be a grounds for not approving the app?