iphone - How To Add Edit Mode To UITableView? -


i have table lets swipe delete. want have edit button in nav bar user can change cell's title text.

i have far nothing happens

uibarbuttonitem * editbutton = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemedit target:self action:@selector(setediting:animated:)]; [self.navigationitem setleftbarbuttonitem:editbutton]; [editbutton release];  - (void)setediting:(bool)editing animated:(bool)animate {     [super setediting:editing animated:animate];     if(editing)     {         nslog(@"editmode on");     }     else     {         nslog(@"done leave editmode");     } }  -(void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath  {      if (editingstyle == uitableviewcelleditingstyledelete)       {          // delete managed object given index path          nsmanagedobjectcontext *context = [self.fetchedresultscontroller managedobjectcontext];          [context deleteobject:[self.fetchedresultscontroller objectatindexpath:indexpath]];          nslog(@"fetched results : \n%@\n",[self.fetchedresultscontroller fetchedobjects]);           // commit change.          nserror *error = nil;           // update array , table view.          if (![managedobjectcontext save:&error])           {              // handle error.          }      }  } 

just have or uncomment on viewdidload:

    self.navigationitem.rightbarbuttonitem = self.editbuttonitem; 

and implement

- (void)setediting:(bool)editing animated:(bool)animate { if(editing) {     nslog(@"editmode on"); } else {     nslog(@"done leave editmode"); }      [super setediting:editing animated:animate];  } 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -