Last active
November 22, 2018 11:24
-
-
Save muhlenXi/663574396829d2b6cd75e13333a4c216 to your computer and use it in GitHub Desktop.
Segue 正、反向传值
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?) { | |
if let identifier = segue.identifier { | |
if identifier == "ToBeauty" { | |
let desVC = segue.destination as! BeautyViewController | |
let index = pickerView.selectedRow(inComponent: 0) | |
desVC.imageName = imageNames[index] | |
desVC.name = names[index] | |
} | |
} | |
} | |
// 反向传值 需要拖动事件 Action 到 ViewController Exit中 | |
@IBAction func back (unwindSegue: UIStoryboardSegue) { | |
print("backed") | |
let sourceVC = unwindSegue.source as! BeautyViewController | |
print(sourceVC.reverseValue) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment