【发布时间】:2019-10-07 01:36:49
【问题描述】:
访问 ViewController 的问题出在哪里:来自 AnotherClass 的 UIViewController 标签(此处:名为 timerLabel 的出口)。我想设置一个文本。
class AnotherClass{
//[...]
func updateTimeLabel(){
// To Solve!!!*******
//class name is ViewController?
let myLabel = ViewController.timerLabel
myLabel.text = "HiDuEi"
}
//[...]
// error message is:
//Instance member 'timerLabel' cannot be used on type 'ViewController'
}
我怎样才能正确访问 ViewController 类(称为 ViewController)并在那里访问我的插座(一个标签),称为 timerLabel? 谢了
【问题讨论】:
标签: swift inheritance viewcontroller xcode4.2