i am placing a toolbar at the top of my view with edit button.
For edit button i am giving action like edit the table as shown below.
- (IBAction)editModeForTable {
[tableview setEditing:YES animated:YES];
NSLog(@"edit button clicked ");
}
Now what i need is when i click on edit button i need to change this edit button to done button.
this is myscreen.
when ever i click on edit i need to set edit mode for table and change edit button to done.
similarly when ever i click on done button i need to change that done to edit button and edit mode should be false.
Update:
- (IBAction)editModeForTable {
if (buttonClickid == 1) {
[allLIsts setEditing:YES animated:YES];
mybutton.style = UIBarButtonSystemItemDone;
mybutton.title = @"Done";
buttonClickid = 2;
NSLog(@"mmm");
}
if (buttonClickid == 2) {
[allLIsts setEditing:NO animated:YES];
mybutton.style = UIBarButtonSystemItemEdit;
mybutton.title = @"Edit";
buttonClickid = 1;
NSLog(@"ppp");
}
NSLog(@"edit button clicked ");
}
this is button action where buttonclickid is int.
it executes both conditions why?
Similiar to revert back.
btn is an IBOutlet connected to the button in Interface Builder, or your created UIBarButtonItem.
Your if logic is broken.