iOS - UITableView - 取消删除行 - 按钮动画只有附件视图存在 [英] iOS - UITableView - cancel delete row - button animation works only accessory view is present
本文介绍了iOS - UITableView - 取消删除行 - 按钮动画只有附件视图存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
概述(已编辑)
我有UITableView,当我滑动时,显示删除按钮,当我触摸else,
- 如果我添加了附件(披露指示符),则当删除被取消时,删除按钮会随动画消失。
strong>无附件
- 如果我从表格视图单元格中删除附件,则删除取消不会显示任何动画。
问题
- 我不想要附件,但我想要删除取消动画,是否有办法实现这一点?
解决方案
在iOS 6上,这个bug仍然存在。有两种方法可解决此问题:
解决方案1:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// [...]
cell.accessoryView = [UIView new];
// [...]
}
解决方案2
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.accessoryView = [UIView new];
}
这样当删除行被取消时,按钮会随动画消失。
Overview (Edited)
I have UITableView, when I swipe, the delete button appears, when I touch else where, the delete button just disappears without any animation.
With Accessory
- If I add an accessory (Disclosure Indicator), when the delete is cancelled, the delete button vanishes with animation.
Without Accessory
- If I remove the accessory from the table view cell, then delete cancellation doesn't show any animation.
Question
- I don't want the accessory but i want the delete cancellation animation, is there a way to achieve this ?
解决方案
On iOS 6 this "bug" still exists. There are 2 ways to workaround this problem:
Solution 1:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//[...]
cell.accessoryView = [UIView new];
//[...]
}
Solution 2
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.accessoryView = [UIView new];
}
This way when "remove row" is canceled, the button disappears with animation.
这篇关于iOS - UITableView - 取消删除行 - 按钮动画只有附件视图存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文