[英]Swift present ViewController programmatically while showing segues(arrows) in storyboard
I really love the graphical interface of the storyboard designer in Xcode, because all the segues are displayed with an arrow. 我真的很喜欢Xcode中情节提要设计器的图形界面,因为所有segues都用箭头显示。
But sometimes, when there is more complexity (eg variable to pass), I have to use a programatic way to switch to another ViewController. 但是有时候,当有更多的复杂性(例如要传递的变量)时,我不得不使用一种编程方式来切换到另一个ViewController。
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let nextViewController = storyBoard.instantiateViewController(withIdentifier: "HomeViewController") as! HomeViewController
// pass variable
nextViewController.email = self.textfieldEmail.text!
self.present(nextViewController, animated:true, completion:nil)
I dislike, that some of the segues in my App are displayed with an arrow in storyboard, while the more complex ones are not. 我不喜欢我的应用程序中的某些脚本在情节提要板上显示为箭头,而较复杂的脚本则没有。 Is there any way to show those more complex segues with an arrow in the Main.storyboard?
有没有办法在Main.storyboard中用箭头显示那些更复杂的标记?
There are two ways to achieve this: 有两种方法可以实现此目的:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.