Last active
November 23, 2018 01:44
-
-
Save muhlenXi/cd382fab42b8189f83beb39ed844f08c to your computer and use it in GitHub Desktop.
一个 segue 的 prepare 方法 demo
This file contains 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
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { | |
// Get navigation controller | |
let naviController = segue.destination as! UINavigationController | |
// Get view controller | |
let todoDetailController = naviController.topViewController as! TodoDetailTableViewController | |
if segue.identifier == "AddTodo" { | |
todoDetailController.title = "Add todo" | |
// Todo | |
} | |
if segue.identifier == "EditTodo" { | |
todoDetailController.title = "Edit todo" | |
// Todo like send value | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment