您的位置:首页 > 产品设计 > UI/UE

iOS UITableViewCell 表格式图滑动删除

2016-05-24 10:10 447 查看

iOS UITableViewCell 表格式图滑动删除

//进入编辑模式,按下出现的编辑按钮后
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle ==UITableViewCellEditingStyleDelete)
{//如果编辑样式为删除样式
if (indexPath.row<[self.contactNameArray count])
{
[self.contactNameArray removeObjectAtIndex:indexPath.row];//移除数据源的数据
[self.contactNumberArray removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft];//移除tableView中的数据
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息