【发布时间】:2018-09-05 06:01:25
【问题描述】:
尝试使用 segue 从我的第一个 ViewController 移动到我的第二个 ViewController(都使用相同的情节提要)。我的第一个 ViewController 有两个按钮,一个是“男性”,一个是“女性”(我知道,不是每个人都与这两个按钮相关联),我希望任何一个在单击后移动到第二个 ViewController。我将按钮拖放到我的代码中以获得以下内容:
@IBAction func femaleButton(_ sender: AnyObject)
{
Globals.onboardingList.append("girl")
print("it's a girl!")
performSegue(withIdentifier: "femaleSegue", sender: self)
}
男性按钮是相同的。使用 printlines 我知道该程序在“performSegue”行之前一直有效。我添加了视觉序列并将它们的标识符设置为maleSegue 和femaleSegue。但是,我收到以下错误:
Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[Train.SecondVC
_setViewDelegateContentOverlayInsetsAreClean:]: unrecognized selector
sent to instance 0x7fc482d02b00'
非常感谢您的帮助!
【问题讨论】:
-
看起来应用程序在第二个 vc 中崩溃了。你能在第二个vc中添加代码吗?
-
override func viewDidLoad() { print("got to second page") super.viewDidLoad() // 加载视图后做任何额外的设置。 } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // 处理所有可以重新创建的资源。 }
-
只有原始的东西......在 viewDidLoad() 中有一个打印行,永远不会出现
-
检查第二个视图控制器的接口生成器中分配的类
-
感谢您的帮助,已修复!
标签: ios swift segue uistoryboard unrecognized-selector