Sanandiya Vipul Sanandiya Vipul - 2 months ago 18
Objective-C Question

How to set Tableview Cell Movable with option (Share,Done,Delete) Button ? and it's Action ?


I Want Set Movable Tableview Cell with Button Action.And how can i manage button action.

How Can i implement this stuff.

Here i have Attached image i want like this Image.


Thank you in advance

enter image description here

Answer

You can do it withoutUsing any third party control, using UITableViewRowAction of default UITableView..

Below is the code snippet...

- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewRowAction *editAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@" Edit " handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
        // maybe show an action sheet with more options
        //        [self callBlockUser];

    }];
    editAction.backgroundColor = [UIColor lightGrayColor];

    UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
        // maybe show an action sheet with more options
        //        [self callBlockUser];


    }];
    deleteAction.backgroundColor = [UIColor redColor];
    return @[deleteAction,editAction];
}