We have switched the Table view from the buttons on our own navigation bar to edit mode as shown below.However, when I used editButton, there was an animation with a red button on the left that went into edit mode, but it disappeared with this method.Is there a way to add animation?
let anotherButton: UIBarButtonItem=UIBarButtonItem(title: "Show", style: UIBarButtonItemStyle.Plain, target:self, action: "openMenu:")
self.navigationItem.rightBarButtonItem=anotherButton;
US>funcopenMenu (sender: UIBarButtonItem) {
self.setEditing (editing, animated:true)
editing=!editing
}
self.setEditing (editing, animated:true)
I think this part will be in edit mode with animation using the following code
self.tableView.setEditing (banimated:true)
How about preparing a flag?
var flag = false
let anotherButton: UIBarButtonItem=UIBarButtonItem(title: "Show", style: UIBarButtonItemStyle.Plain, target:self, action: "openMenu:")
US>funcopenMenu (sender: UIBarButtonItem) {
if flag{
flag = false
} else {
flag = true
}
self.tableView.setEditing (flag, animated:flag)
tableView.isEditing=flag
}
© 2024 OneMinuteCode. All rights reserved.