UPDATE:
Thanks to information from \"Evgeny S\" I\'ve been able to determine that what is covering up the delete button is the cell background. I had the following f
here is a better way just make sure you subclass UITableviewController for better performance and add this code
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
CGRect frame = self.tableView.frame;
if(editing){
[self.tableView setFrame:CGRectMake(0, frame.origin.y, frame.size.width, frame.size.height)];
//other codes to run if needed
}else{
[self.tableView setFrame:frame];
//other codes to run if needed
}
}
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?
I'm still seeing this problem after updating to XCode 5.0.1 but I've used a different workaround which is to use a boolean named changeTitle
set to NO in willBeginEditingRowAtIndexPath
and set to YES in editingStyleForRowAtIndexPath
if we're not in row deletion mode.
Then I use that variable to pad the button title with some extra spaces in titleForDeleteConfirmationButtonForRowAtIndexPath
.
-(NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 && changeTitle) {
return @" Delete";
}
return @"Delete";
}
It works for me but the main drawback is that the confirmation area is wider than you think it is so an unintentional delete is possible.
You can avoid the problem by setting background you want for the uitableview and setting cell.backgroudColor = [UIColor clearColor];
and cell.contentView.backgroundColor = [UIColor clearColor];
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];
}
If you have project started in iOS 6 SDK and use storyboards, this might be the issue with constraints. Try deleting all of cells constraints and fall back to suggested. This could resolve issues with delete button. I had such problems in two different projects and they were resolved described way.