Pergunta

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


(source: mixdesign.kz)

Foi útil?

Solução

@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

Outras dicas

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

You could implements

- (void)willTransitionToState:(UITableViewCellStateMask)state

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top