我在編程方面很新,我試圖將這個如果其他結構轉換成Swift語言的切換案例,我感謝您的幫助,謝謝。轉換如果其他結構切換到SWIFT案例
這裏是我的代碼
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if (segue.identifier == "ShowDefinition") {
if let destinationViewController = segue.destinationViewController as? EnglishViewController {
if let definition = sender as? String {
if definition == "Abstraction" {
destinationViewController.titleMsg = "Abstraction"
destinationViewController.definitionMsg = "definition 1"
} else if definition == "Binary System" {
destinationViewController.titleMsg = "Binary System"
destinationViewController.definitionMsg = "definition 2"
} else if definition == "Computer" {
destinationViewController.titleMsg = "Computer"
destinationViewController.definitionMsg = "definition 3"
} else if definition == "Internet" {
destinationViewController.titleMsg = "Internet"
destinationViewController.definitionMsg = "definition 4"
} else if definition == "Virtual Reality" {
destinationViewController.titleMsg = "Virtual Reality"
destinationViewController.definitionMsg = "definition 5"
}
}
}
}
}
非常感謝你! –