0

I want to give some space between UITableView edit mode delete button and cell left side (See screenshot below).
Any idea?


(source: mixdesign.kz)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Almas Adilbek
  • 4,371
  • 10
  • 58
  • 97

3 Answers3

2

Setting indentationLevel/indentationWidth did not work for me.

What worked for me was subclassing UITableViewCell and customized -layoutSubviews:

#define LEFT_EDITING_MARGIN 42

- (void)layoutSubviews
{
    [super layoutSubviews];

    if (self.editing && self.contentView.frame.origin.x != 0) {
        CGRect frame = self.contentView.frame;
        CGFloat diff = LEFT_EDITING_MARGIN - frame.origin.x;
        frame.origin.x = LEFT_EDITING_MARGIN;
        frame.size.width -= diff;
        self.contentView.frame = frame;
    }
}
Marián Černý
  • 15,096
  • 4
  • 70
  • 83
1

You could implements

- (void)willTransitionToState:(UITableViewCellStateMask)state

in your UITableViewCell subclass to slightly move your subviews in order to have a larger padding.

Xval
  • 938
  • 5
  • 17
1

@property(nonatomic) NSInteger indentationLevel is a property define din UITableViewCell documentation. Using this you can set the indentation level of a tableview Cell. Set this property from your - (void)willTransitionToState:(UITableViewCellStateMask)state

zahreelay
  • 1,742
  • 12
  • 18