How to change Edit/Done button title in UINavigationBar

前端 未结 3 2278
执念已碎
执念已碎 2021-02-20 06:26

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

3条回答
  •  孤独总比滥情好
    2021-02-20 06:37

    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

提交回复
热议问题