美文网首页
UITableViewCell左滑删除按键

UITableViewCell左滑删除按键

作者: 风继续吹0 | 来源:发表于2016-08-18 10:50 被阅读31次

添加以下代理方法

//返回YES表示可编辑
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
//编辑样式
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewCellEditingStyleDelete;
}
//按键title
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(3_0) {
return @"删除";
}
//处理按键点击事件
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
}
}

相关文章

网友评论

      本文标题:UITableViewCell左滑删除按键

      本文链接:https://www.haomeiwen.com/subject/hbdvsttx.html