Jump to content

- - - - -

How to change title of Edit button to "Delete"

view-controllers models sections actions

  • Please log in to reply
4 replies to this topic

#1 Balachandhar


    Experienced Member

  • STV 3.0 Pro
  • PipPipPipPip
  • 87 posts
Reputation: 21

Posted 24 April 2014 - 02:46 AM



I am using SCArrayOfObjectsModel to show list of items and     self.navigationBarType = SCNavigationBarTypeAddEditRight; to show Add, Edit buttons.


Now I want to change the edit button text as Delete.  I am trying by self.navigationItem.rightBarButtonItem.title = @"Delete"; then I am getting a right bar button as "Delete"


but the problem is when i select the done button(when it is in edit mode) then the button title is automatically changed to "Edit" but i want it always show as "Delete".


Even i tried with the following but these methods are not fired.

- (void)editingModeCancelButtonAction

- (void)editButtonAction





#2 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 545 posts
  • LocationIreland
Reputation: 137

Posted 25 April 2014 - 06:34 AM

Hi bala,


Using a different SCNavigationBarType, SCNavigationBarTypeAddLeft for example,  and adding in your own Delete button with it's own actions, might be a solution.



#3 Everett



  • STV 5.0 Pro
  • PipPipPipPipPip
  • 191 posts
  • LocationMichigan
Reputation: 60

Posted 25 April 2014 - 09:34 AM

Hi Bala,


There are a couple of different ways to work with the navigation bar types and the different buttons.  For your approach here is a suggestion that should accomplish your requirements.


Use the editButtonAction method to override the edit button's behavior, and in the process you can change the title of the button.  Something like this:


-(void)useModelForTest {


    self.navigationBarType = SCNavigationBarTypeAddEditRight;

    self.editButton.title = @"Delete";


    SCClassDefinition *peopleDef = [SCClassDefinition definitionWithClass:[Person class] autoGeneratePropertyDefinitions:YES];


    SCArrayOfObjectsModel *model = [SCArrayOfObjectsModel modelWithTableView:self.tableView items:self.people itemsDefinition:peopleDef];


    self.tableViewModel = model;



-(void)editButtonAction {


    if ([self.tableView isEditing]) {


        [self.tableView setEditing:NO animated:YES];

        self.navigationItem.rightBarButtonItem.title = @"Delete";


    else {


        [self.tableView setEditing:YES animated:YES];

        self.navigationItem.rightBarButtonItem.title = @"Done";




I tested this in a SCTableViewController and it worked they way you suggested.  

Best of luck

Edited by Everett, 25 April 2014 - 09:34 AM.

#4 ozie



  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 526 posts
  • LocationAustralia
Reputation: 169

Posted 25 April 2014 - 05:21 PM

i would do what Dave said.. i would have said to do the same thing

P.S. I hate Swift.. don't talk Swift.. Too old school to learn yet another programming language.

#5 Balachandhar


    Experienced Member

  • STV 3.0 Pro
  • PipPipPipPip
  • 87 posts
Reputation: 21

Posted 30 April 2014 - 11:20 AM

thanks Dave and Everett, i have added my own button and achieved the same.

Also tagged with one or more of these keywords: view-controllers, models, sections, actions

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users