【发布时间】:2018-04-06 22:38:02
【问题描述】:
我真的很喜欢 Xcode 中故事板设计器的图形界面,因为所有的转场都是 用箭头显示。
但有时,当有更多复杂性(例如要传递的变量)时,我必须使用编程方式切换到另一个 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)
我不喜欢我的应用程序中的某些转场在情节提要中用箭头显示,而更复杂的则没有。 有没有办法在 Main.storyboard 中用箭头显示那些更复杂的转场?
【问题讨论】:
-
这不就是
UIViewController的prepare(for:sender:)方法的用途吗?
标签: ios swift xcode uiviewcontroller storyboard