获取获取请求并从核心数据中获取值。基于值F或M,我想要转向VC。它一直在App Delegate上崩溃。我正在使用标签栏控制器来点击进行计算的VC,然后应该转到适当的VC。
func makeSegue() {
print("\(meetGenderText.text!)")
if (meetGenderText.text == "F") {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("scoreFemale") as! ScoreMeetFemaleVC
presentViewController(vc, animated: true, completion: nil)
performSegueWithIdentifier("scoreFemale", sender: nil)
} else {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("scoreMale") as! ScoreMeetFemaleVC
presentViewController(vc, animated: true, completion: nil)
performSegueWithIdentifier("scoreMale", sender: nil)
}
}
答案 0 :(得分:0)
您不应同时使用presentViewController
和performSegueWithIdentifier
。如果您想使用performSegueWithIdentifier
,请确保故事板中存在segue,并从您UIViewController
调用的performSegueWithIdentifier
开始。还要确保代码中的标识符与storyboard中的segues标识符匹配。