IOS7 UItableview Switching the contents of the editing mode

When I enter edit mode UITableViewin iOS 7, the contents of my cell overlap the delete button. enter image description here

I checked the UITableViewCell content overlaps the delete button in edit mode in iOS7 , but this does not help in my case.

I am dynamically creating my cell in tableView:cellForRowAtIndexPath.

Please let me know if your ideas are on this issue.

+4
source share
3 answers
- (void)layoutSubviews
{
 [super layoutSubviews];



self.contentView.frame = CGRectMake(0,
                                    self.contentView.frame.origin.y,
                                    self.contentView.frame.size.width,
                                    self.contentView.frame.size.height);



if ((self.editing
    && (_state & UITableViewCellStateShowingDeleteConfirmationMask))){
    float indentPoints = self.indentationLevel * self.indentationWidth;
    self.contentView.frame = CGRectMake(50,
                                        self.contentView.frame.origin.y,
                                        self.contentView.frame.size.width - indentPoints - 30,
                                        self.contentView.frame.size.height);
 }
}
0
source

I really use this full implementation to make everything look good:

- (void)layoutSubviews
{
[super layoutSubviews];

self.contentView.frame = CGRectMake(0,
                                    self.contentView.frame.origin.y,
                                    self.contentView.frame.size.width,
                                    self.contentView.frame.size.height);

if ((self.editing
    && ((_state & UITableViewCellStateShowingEditControlMask)
        && !(_state & UITableViewCellStateShowingDeleteConfirmationMask))) ||
    ((_state & UITableViewCellStateShowingEditControlMask)
     ))
{
    float indentPoints = self.indentationLevel * self.indentationWidth;
    self.contentView.layer.masksToBounds = YES;
    self.contentView.frame = CGRectMake(50,
                                        self.contentView.frame.origin.y,
                                        self.contentView.frame.size.width - indentPoints,
                                        self.contentView.frame.size.height);
}


if ((self.editing
    && (_state & UITableViewCellStateShowingDeleteConfirmationMask)))
{
    float indentPoints = self.indentationLevel * self.indentationWidth;
    self.contentView.frame = CGRectMake(50,
                                        self.contentView.frame.origin.y,
                                        self.contentView.frame.size.width - indentPoints - 30,
                                        self.contentView.frame.size.height);
}
}
0
source

Perhaps you are setting the setBackgroundImage cell for the cell to cellForRowAtIndexPath (delegate method). Do not install it here. Set the image to:

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { cell.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"cellList.png"]]; }
0
source

All Articles