设备轮换后iOS 11中的UITableViewCell操作被破坏 [英] UITableViewCell actions in iOS 11 after device rotation are broken
问题描述
我使用标准的UITableView和UITableViewRowAction类。在设备轮换后的iOS 11中我有奇怪的行为,这里是样本:
I use standard UITableView and UITableViewRowAction classes. In iOS 11 after device rotation I have weird behaviour, here is the sample:
基本上,它打破了表格视图。在更复杂的细胞和表格的真实应用程序中它更糟糕(重叠细胞等)我已经尝试在旋转后调用UITableView上的SetNeedsDisplay(),但没有帮助。
Basically, it breaks the table view. In real app with more complicated cells and table it even worse (overlapping cells, etc.) I already tried to call SetNeedsDisplay() on UITableView after rotation, doesn't help.
在iOS 10中,操作看起来略有不同并且工作正常。
In iOS 10 actions looked slightly different and work perfectly.
推荐答案
有些评论提到了这一点,但明显的赢家是取消在轮换时编辑单元格:
Some of the comments mention this, but the clear winner is to cancel editing the cell on rotation:
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[self.tableView setEditing:NO animated:NO];
}
这篇关于设备轮换后iOS 11中的UITableViewCell操作被破坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!