可选的价值我想这个代码意外地发现零而展开的迅速
let secondView = SecondViewController(nibName: "secondView", bundle: nil)
secondView.secondViewLabel.text = self.TextBox.text
navigationController?.pushViewController(secondView, animated: true)
我试图从文本框中的值传递给一个标签,在未来视图controller.But我得到一个错误
我也试着将文本框的值复制到第二个视图控制器中声明的sting中,该控制器也返回nil。
let secondView = SecondViewController(nibName: "secondView", bundle: nil)
secondView.toPass = self.TextBox.text
navigationController?.pushViewController(secondView, animated: true)
println(secondView.toPass) // i get the string printed here
在第二视图控制器
var toPass:String!
鉴于没有负载
secondLabel.text = toPass
println(toPass) // i get the string printed nil
帮助我,大家好我是新来的迅速
什么是TextBox?它是什么类型?什么是TextBox.text的类型? – JohnVanDijk 2014-09-30 06:17:31
@IBOutlet weak var TextBox:UITextField! – vishnuvarthan 2014-09-30 06:32:05