How to change uitableview delete button text
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Changing the delete button text in a UITableView depends on which swipe-action API you are using. In older table view editing code, the delegate method titleForDeleteConfirmationButtonForRowAt was the answer. In modern iOS code, the preferred approach is to define a custom UIContextualAction inside trailingSwipeActionsConfigurationForRowAt.
Legacy Approach: Delete Confirmation Title
Older UITableView editing APIs allow you to replace the default “Delete” text directly.
This works in legacy edit-confirmation flows where the system shows a delete confirmation button after swiping.
However, if you are building new code, this is no longer the API most teams should reach for first.
Modern Approach: UIContextualAction
For iOS 11 and later style swipe actions, define the action yourself.
This gives you direct control over the label, style, icon, and behavior.
Why the Modern API Is Better
With UIContextualAction, you are not just renaming “Delete.” You are defining the entire swipe interaction. That means you can:
- use custom text such as “Archive” or “Remove”
- set a background color
- attach an image
- choose whether the action is destructive or normal
Example with color and icon:
This is far more flexible than the old delete-confirmation title hook.
Keep the Action Name Honest
Do not rename destructive behavior casually. If the action permanently deletes data, the label should communicate that clearly. “Remove” may be appropriate for removing from a list while preserving the underlying item. “Delete” is better if the record is actually destroyed.
Changing button text is a UI customization, but it also changes user expectations. Treat it as a product decision, not just a styling tweak.
Localization
If your app supports multiple languages, localize the action title.
This is easy to forget because swipe action titles are short, but they are still user-facing text.
Editing Style Still Matters in Legacy Code
If you are using the older commit editingStyle flow, remember that title customization alone does not implement the deletion behavior.
The title controls the button label. The commit method controls what actually happens.
Testing the Swipe UX
After changing the text, test:
- long labels that may truncate
- localization lengths
- destructive color semantics
- VoiceOver announcements
Swipe actions are compact UI elements, so wording and accessibility matter more than they first appear to.
Common Pitfalls
The main mistake is using the legacy title method in a codebase that already relies on modern swipe actions. Another is renaming a destructive action to something softer and thereby making the behavior ambiguous. Developers also sometimes forget that changing the title does not change the underlying delete logic. Finally, swipe action text should be localized and kept short enough to fit comfortably on smaller devices.
Summary
- In legacy
UITableViewediting, usetitleForDeleteConfirmationButtonForRowAt. - In modern iOS code, use
UIContextualActioninsidetrailingSwipeActionsConfigurationForRowAt. - Choose button text that accurately reflects the action’s effect.
- Localize the title for multi-language apps.
- Test the resulting swipe interaction for truncation, accessibility, and behavior clarity.

