I am setting the height of a UITableViewCell so that it will clip and not all the content for the row is visible. This works fine in iOS7 both "not edit" mode and "edit" mode. In iOS8 it is only working in "not edit" mode. When editing the entire content of the cell is shown after the red delete button on the left is tapped so that you see the delete button on the right.
I had been setting cell.clipsToBounds = YES
and thought this was all I needed to do.
EDIT: I also tried cell.contentView.clipsToBounds = YES
but this didn't work.
iOS7: (this is what I want)
iOS8:
I tried Vitaliy and ToddB's solutions and unfortunately they were not always 100% consistent for me although they did work most of the time.
I hate to have to override layoutSubviews but I've found no other solution that works 100% of the time thus far :'(
override func layoutSubviews() {
super.layoutSubviews()
self.contentView.clipsToBounds = true
}
Looks like the UITableView in iOS 8 set cell.contentView.clipToBounds to NO when begin editing. This code help me resolve your issue:
- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.contentView.clipsToBounds = YES;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With