问题描述
由于是在iPhone的邮件应用程序做的,我想有删除按钮,将出现在右滑动可编辑表格单元格留下来的动画的,当它被驳回(依路叩击声,比上的UITableViewCell
)的删除按钮在其他地方。相反,我的删除按钮立即消失,当它被驳回。
As is done in the iPhone Mail app, I would like have the "Delete" button which appears on swiping an editable table cell from right to left to animate when it is dismissed (by way of tapping elsewhere than the Delete button on the UITableViewCell
). Instead, my Delete button immediately disappears when it is dismissed.
要调用摆在首位刷卡表格单元格的删除按钮,我已经添加(到这是 UITableViewDataSource
和的UITableViewDelegate类
为的UITableView
有问题):
To invoke the Delete button on swiping a table cell in the first place, I have added (to the class which is the UITableViewDataSource
and UITableViewDelegate
for the UITableView
in question):
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
//add code here for when you hit delete
}
}
有什么事,当它被驳回我可以添加到这个将处理删除按钮的动画?谢谢!
Is there something I might add to this which will handle the animation of the Delete button when it is dismissed? Thank you!
推荐答案
我有同样的问题,刚才发现有就是当我们有空cell.textLabel.text一些问题。试加在
I had the same problem, just now found out that there is some problem when we have empty cell.textLabel.text. Try add in
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath:
{
{...} // omitted code
cell.textLabel.text = @"whatever";
cell.textLabel.hidden = YES;
}
通过此按钮刷卡解雇适当,但为什么呢?
PS:自定义测试细胞和内置i.n
With this swipe button dismiss proper, but WHY?PS: tested with custom cells and built i.n
这篇关于我怎样才能动画的UITableView轻扫到删除按钮的解雇?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!