gpt4 book ai didi

ios - 使用 segue 在 Swift 中的 ViewController 之间传递数据

转载 作者:搜寻专家 更新时间:2023-11-01 06:40:07 26 4
gpt4 key购买 nike

<分区>

我对正在观看的教程中完美运行的代码有疑问。我在教程中看到他们使用的是 Swift 1,我想我有 Swift 2。 第一个 View Controller :

    import UIKit

class ViewController: UIViewController {

@IBOutlet weak var textfield1: UITextField!


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.
}

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
var DestViewController : ViewTwo = segue.destinationViewController as ViewTwo // here is where I get the error

}

我应该改变什么?谢谢

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com