Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableViewCell, Delete Button Frame?

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 possible I would like to move it down to the cyan guide show.

enter image description here

like image 684
fuzzygoat Avatar asked Jul 28 '11 15:07

fuzzygoat


1 Answers

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
like image 178
UIBuilder Avatar answered Nov 13 '22 06:11

UIBuilder