Is it possible to edit swipe to delete (in a UITableView) the default text or translate it?

Is it possible to transfer swipe to delete message in UITableView in iOS7?

I use two delegate methods to show the delete system button for deletion in specific UITableView rows

+6
source share
2 answers

Yes, implement the UITableViewDelegate function:

 func tableView(tableView: UITableView, titleForDeleteConfirmationButtonForRowAtIndexPath indexPath: NSIndexPath) -> String! { return "your string" //or customize for each indexPath } 
+12
source

The titleForDeleteConfirmationButtonForRowAt delegate present in the UITableViewDelegate can be used to change the "Delete" text in the table cell.

 func tableView(_ tableView: UITableView, titleForDeleteConfirmationButtonForRowAt indexPath: IndexPath) -> String? { return NSLocalizedString("erase".localized, comment: "") } 
0
source

Source: https://habr.com/ru/post/984968/


All Articles