UITableView edit mode delete button padding-right

3.1k views Asked by At

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


(source: mixdesign.kz)

3

There are 3 answers

0
zahreelay On BEST ANSWER

@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

0
Xval On

You could implements

- (void)willTransitionToState:(UITableViewCellStateMask)state

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

0
Marián Černý On

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;
    }
}