Thursday 1 October 2015

How To Work With UITableView Delegate method CommitEditingStyle In Ios/Iphone


=> Here Used One Delegate Method Of UITableView :

=> when Use Swipe Delete adn Swipe Insert Swift None :
=> on Swipe Action Its Work on UITableView Delegae EditeCommiteStyle Like This:

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


- (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);
    }
}