Swift Take a variable in second File ButtonViewController.swift

不羁岁月 提交于 2019-12-11 20:46:05

问题


In My project i have two file ViewController.swift and ButtonViewController.swift . In ViewController i have this code

var nomeLabel:String!
func goToView(sender: UIButton!) {
// self.performSegueWithIdentifier("goToView", sender: self) // I used This for Go to Second View in Another moment
var label: UILabel = UILabel()
label.frame = CGRectMake(self.view.frame.size.width/2, 10, 150, 21);
label.backgroundColor = UIColor.blackColor()
label.textColor = UIColor.whiteColor()
label.textAlignment = NSTextAlignment.Center
label.text = "\(self.nomeLabel)"
self.myView.addSubview(label)
})
}

and now I want to take the value of the variable self.nomeLabel in the second file ButtonViewController.swift. how can I view this variable in ButtonViewController.swift ?

来源:https://stackoverflow.com/questions/26980929/swift-take-a-variable-in-second-file-buttonviewcontroller-swift

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!