Monday, 28 September 2015

Work With UITableView Delegate Method Swipe Dlete And Insert CommitEditingStyle In Ios/iphone


==> Using Some swipe Delete  And Insert Item Using This UITableViewDelegate :-

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(indexPath.row == 0)
    {
        return UITableViewCellEditingStyleInsert;
    }
    else if(indexPath.row == 1)
    {
        return UITableViewCellEditingStyleDelete;
    }
   
    return UITableViewCellEditingStyleNone;
}

==> Used Insert And Delete In UITableView :-

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(editingStyle == UITableViewCellEditingStyleDelete)
    {
        NSLog(@"Delete action performed for row - %lu", indexPath.row);
    }
    else if(editingStyle == UITableViewCellEditingStyleInsert)
    {
        NSLog(@"Insert action performed for row - %lu", indexPath.row);
    }
}