Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView Swipe to delete: how to customize button and action?

I want to perform different action, not delete objects but archive them. When user swiped on tableViewCell I need to show "Archive" instead of delete. change "Delete" button text and color to something else.

How do I customize "Delete mode" appearance?

like image 362
Rod Avatar asked Aug 14 '09 09:08

Rod


People also ask

How do you customize swipe edit buttons in Uitableview?

As of iOS 8.0 there's an easy way to customize the list of buttons that appear when the user swipes from right to left: editActionsForRowAt . Return an array of UITableViewRowAction objects that have titles and styles (and also background colors if you want to customize their appearance), and iOS does the rest.

What is Uitableview in Swift?

A view that presents data using rows in a single column. iOS 2.0+ iPadOS 2.0+ Mac Catalyst 13.1+ tvOS 9.0+


1 Answers

Apparently in 3.0 and later there is such method:

- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);
like image 135
Rod Avatar answered Oct 13 '22 01:10

Rod