Avoid UITableViewCell moving when toggling between editing mode
Alright, I have some weird behavior and this question goes to the people out there that got that issue already.
I have 4 differen开发者_C百科t subclasses of UITableViewCells. They are all very similar (I can't see the differences that would bring the problem up).
Now my UITableView's delegate have the following code:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section < 2)
return UITableViewCellEditingStyleNone;
else if (indexPath.row == [[AccountManager sharedManager].accounts count])
return UITableViewCellEditingStyleNone;
else return UITableViewCellEditingStyleDelete;
}
Now, what I'd expect would be to have the first 2 rows not changing upon changing the state of setEditing: property of my tableView.
Here's the tricky part:
the first 2 rows they move right without having the "delete icon" appearing.
In the last section, the cells don't move a single pixel to the right and only the rows are having the "delete icon" appearing.
Here's some info:
None of my cellviews and subviews implement - (void)layoutSubviews
All of them implement - (void)drawRect:(CGRect)rect
All the cell and cell's subviews ContentMode are set to their default settings All the autoresizingMask are set to their default settings.
Any idea?
If you add your subview directly to the UITableViewCell, the animation won't work when toggling the editing mode in the UITableView.
If you want them to be activated, you should add your subview to UITableViewCell's contentView property.
精彩评论