GuybrushThreepwood
GuybrushThreepwood

Reputation: 5616

Changing Background of Edit Button - UITableView iOS7

I have a UITableView which when edited looks as follows :

enter image description here

Is it possible to somehow change the background behind the delete symbol so that it is not white ?

Upvotes: 1

Views: 152

Answers (2)

Matthias Bauch
Matthias Bauch

Reputation: 90117

The problem ist that contentView gets shifted to the right when you are in editing mode, and because of this all its subviews will move to the right as well.
If your background is an imageView you should not add is as subview to contentView, set it as backgroundView of the cell instead.

Since you can't setup backgroundView from interface builder I would recommend to create a custom subclass of your cell and put the background creation into awakeFromNib.

- (void)awakeFromNib {
    [super awakeFromNib];
    self.backgroundView = [[UIImageView alloc] initWithImage:...];
}

Upvotes: 0

Cem
Cem

Reputation: 60

I hope this help you

UIView *cellBackView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
cellBackView.backgroundColor = [UIColor clearColor];
cell.cellBackgroundView = backView;

Upvotes: 1

Related Questions