楼主好 各位群友好 最近看了一个教程 照着用xcode8.2.1写了一点 但是版本不同 toInt这个不能用了 改成Int(str)还是报错 能麻烦你们帮我看下应该怎么写吗 谢谢 import UIKit class ViewController: UIViewController { @IBOutlet weak var yearofbirth: UITextField! @IBOutlet weak var image: UIImageView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBAction func tapok(_ sender: Any) { //var year=yearofbirth.text.toInt() var year=Int(yearofbirth.text) //上面那句报错的,帮忙看下,谢谢大家 } }