【发布时间】:2019-08-30 17:34:12
【问题描述】:
我有一个带有两个按钮的视图,每个按钮都应该执行不同的 segue 并转到不同的视图,但它们都转到相同的视图
我尝试删除并创建新的转场
这是带有两个按钮的视图控制器
import UIKit
class DSViewController: UIViewController {
var finalTol = ""
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
print(finalTol)
view.layer.cornerRadius=30
}
@IBAction func diseaseDone(_ sender: Any) {
performSegue(withIdentifier: "disease", sender: self)
}
@IBAction func symptomsDone(_ sender: Any) {
performSegue(withIdentifier: "symptom", sender: self)
}
override func viewWillAppear(_ animated: Bool) {
navigationController?.navigationBar.layer.cornerRadius = 30
navigationController?.navigationBar.barTintColor = UIColor.white
navigationController?.navigationBar.clipsToBounds = true
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
switch (segue.identifier) {
case "disease":
let vc = segue.destination as! DiseaseViewController
vc.finalTol=self.finalTol
case "symptom":
let vc = segue.destination as! SymptomViewController
vc.finalTol = self.finalTol
default:
print(finalTol)
}
}
}
我预计疾病会出现在 diseaseViewController 中,症状会出现在 SymptomViewController 中,但它们都会出现在症状中
【问题讨论】: