KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to replace the default editing mode behaviour of the cells. I dont want the red circle with line left accessory view to appear. Upon entering edit mode I need it to shift the content view left & display my delete button. What I have so far (custom UITableViewCell) overrides: -(void) setEditing:(BOOL)editing animated:(BOOL)animated { /* don't call super */ // [super setEditing:editing animated:animated]; _isEditing = editing; CGFloat newContentViewX = 0.0f; UIColor *newDeleteButtonColor = [UIColor clearColor]; if ( _isEditing ) { newContentViewX = -40.0f; newDeleteButtonColor = [UIColor redColor]; } if ( animated ) { [UIView animateWithDuration:0.5f delay:0.0f options:UIViewAnimationOptionCurveEaseInOut animations:^ { self.contentView.x = newContentViewX; //change frame.origin.x _deleteButton.backgroundColor = newDeleteButtonColor; } completion:nil]; } else { self.contentView.x = newContentViewX; //change frame.origin.x _deleteButton.backgroundColor = newDeleteButtonColor; } } -(BOOL) editing { return _isEditing; } & this is the result: The above code works great! Until it starts scrolling & the contentview gets reset. back to the first image. The editing flag is not persisting my contentview frame changes. I have added this line: [cell setEditing:_tableView.isEditing animated:NO]; in cellForRowAtIndexPath & although it is calling & setting edit mode correctly my contentview is still in the original position & not the updated S
Tags (comma-separated)
Save Edits
Cancel