MCI*_*ror 13 iphone animation objective-c uitableview
正如在iPhone Mail应用程序中所做的那样,我希望在从右到左滑动一个可编辑的表格单元时出现"删除"按钮,以便在它被解除时进行动画处理(通过点击其上的"删除"按钮以外的其他方式UITableViewCell).相反,我的删除按钮会在解除时立即消失.
要在第一个位置刷一个表格单元格时调用"删除"按钮,我已添加(对于该类UITableViewDataSource和UITableViewDelegate该UITableView问题的类):
// 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
}
}
Run Code Online (Sandbox Code Playgroud)
我可以添加一些东西来处理删除按钮的动画吗?谢谢!
小智 25
我有同样的问题,刚才发现当我们有空的cell.textLabel.text时有一些问题.尝试添加
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath:
{
{...} // omitted code
cell.textLabel.text = @"whatever";
cell.textLabel.hidden = YES;
}
Run Code Online (Sandbox Code Playgroud)
使用此滑动按钮可以正常解除,但是为什么?PS:使用自定义单元测试并内置
您不需要手动设置解雇动画,它的工作方式与调用它相同,因此不确定为什么它在您的应用程序中表现不同。
您是否有机会使用自定义单元格?作为一个尝试的想法,将shouldIndentWhileEditingRowAtIndexPath:方法更改为返回 NO,看看它是否会改变任何内容。我唯一能想到的是,您的内容缩进会干扰删除按钮区域,导致动画无法执行或无法正常运行。
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
return NO;
}
| 归档时间: |
|
| 查看次数: |
3630 次 |
| 最近记录: |