Created
July 3, 2018 03:20
-
-
Save JeremyXue77/33b7816b830e700ae2debbc60765cb13 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @IBAction func changeDeleteMode(_ sender: Any) { | |
| // 遍歷 listTableView 將所有被選取的 cell 取消選取 | |
| for row in 0...myTask.count - 1{ | |
| listTableView.cellForRow(at: [0,row])?.isSelected = false | |
| } | |
| // 判斷左上角的 BarButtonItem.title,進行相對的模式切換 | |
| if self.navigationItem.leftBarButtonItem?.title == "Single" { | |
| self.navigationItem.leftBarButtonItem?.title = "Multiple" | |
| deleteMode = UITableViewCellEditingStyle.insert | |
| } else { | |
| self.navigationItem.leftBarButtonItem?.title = "Single" | |
| deleteMode = UITableViewCellEditingStyle.delete | |
| } | |
| // 如果正在修改的話,則回復到沒有修改的狀態 | |
| if listTableView.isEditing { | |
| setEditing(false, animated: true) | |
| listTableView.isEditing = false | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment