1,423
社区成员
发帖
与我相关
我的任务
分享
@IBAction func toSecond(sender: AnyObject) {
println("ViewController toSecond")
println("\(self.userNameTF.text)")
SecondViewController().secondUserNameTF.text=self.userNameTF.text
self .presentViewController(SecondViewController(), animated: true, completion: nil)
}
谢谢了!class SecondViewController:UIViewController {
var txtName:String = ""
override func viewDidLoad() {
secondUserNameTF.text = txtName //////将从上一个控制器传递过来的值赋给文本框
}
}
toSecond方法应该如下
@IBAction func toSecond(sender: AnyObject) {
var secondVC:SecondViewController = SecondViewController()
secondVC.txtName = self.userNameTF.text
self .presentViewController(secondVC , animated: true, completion: nil)
}