Is there a way to alter the frame of the \"swipe\" [DELETE]
button used on UITableViewCells
? Currently its centred vertically within the cell, but
If you are looking for a strongly true way to solve this problem then you should to subclass of UITableViewCell
and override the all state handling methods for correct drawing your own delete button (do not call super in those methods). But there is another easy way:
@implementation CustomCell
- (void)layoutSubviews {
[super layoutSubviews];
if (self.showingDeleteConfirmation) {
if ([self.subviews count] < 4) return;
UIView *delBtn = [self.subviews objectAtIndex:3];
delBtn.frame = CGRectOffset(delBtn.frame, 0, 10);
}
}
@end
Try changing the frame for Accessory View
Instead of didTransitionToState:
,
How about using the -(void)willTransitionToState:
and setting the frame of the editingAccessoryView
?
- (void)willTransitionToState:(UITableViewCellStateMask)state
{
if (state == UITableViewCellEditingStyleDelete)
{
NSInteger num = 10;
UIView.frame = CGRectMake(UIView.frame.origin.x,UIView.frame.origin.y - num,
UIView.size.width,UIView.size.height);
}
}