我想隐藏UITableView
第一行中的默认删除按钮,对于其余单元格,我想在UITableView
显示默认删除按钮。
Implement Table View delegate method - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
something like this:
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
BOOL aReturnVal = YES;
if (indexPath.section == 0 && indexPath.row == 0) {
aReturnVal = NO;
}
return aReturnVal;
}
Implement below table view delegate method to achieve it.
-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row == 0) {
return false;
}
return YES;
}
below method also need to implement you can put your logic when row is being delete.
-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
//put your delete logic here.
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.