Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Edit/Done button title in UINavigationBar

If Editing mode is enabled for the tableview it shows a button titled Edit, when pressing it it changes the title to done

i was wondering if there is a way to change the Done Button title to something else ?

i already changed the title for the done button.

the code i used is

self.navigationItem.rightBarButtonItem = self.editButtonItem;
self.editButtonItem.title = @"Change";

Now The Edit is Change

How to make Done to something else ?

like image 777
aLFaRSi Avatar asked Nov 17 '12 10:11

aLFaRSi


1 Answers

You can change the title of the edit button like this:-

- (void)setEditing:(BOOL)editing animated:(BOOL)animated
{
    // Make sure you call super first
    [super setEditing:editing animated:animated];

    if (editing)
    {
        self.editButtonItem.title = NSLocalizedString(@"Cancel", @"Cancel");
    }
    else
    {
        self.editButtonItem.title = NSLocalizedString(@"Edit", @"Edit");
    }
}

its working like edit:-

enter image description here

TO

enter image description here

like image 175
Nitin Gohel Avatar answered Oct 12 '22 13:10

Nitin Gohel