问题描述
我有2个ViewController,根据我在FirstViewController上按下的按钮,我想在SecondViewController上显示文本。
在FirstViewController.swift上,我有这个:
var labelsText = String()
@IBAction func Button1(_ sender: UIButton) {
labelsText = "test1"
}
@IBAction func Button2(_ sender: UIButton) {
labelsText = "test2"
}
在SecondViewController.swift上,我有这个:
@IBOutlet var Label: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
Label.text = FirstViewController.labelsText
我总是收到此错误消息:
实例成员'labelsText'不能用于'FirstViewController'类型;您是不是要使用这种类型的值?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)