Guest User

Untitled

a guest
Mar 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
  2.  
  3. UITableViewRowAction *moreAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Button1" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
  4. // maybe show an action sheet with more options
  5. [self.tableView setEditing:NO];
  6. }];
  7. moreAction.backgroundColor = [UIColor blueColor];
  8.  
  9. UITableViewRowAction *moreAction2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Button2" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
  10. [self.tableView setEditing:NO];
  11. }];
  12. moreAction2.backgroundColor = [UIColor blueColor];
  13.  
  14. UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
  15. [self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
  16. }];
  17.  
  18. return @[deleteAction, moreAction, moreAction2];
  19. }
  20.  
  21. deleteAction.backgroundColor = UIColor(patternImage: UIImage(named:"sample")!)
Add Comment
Please, Sign In to add comment