我一直在試圖以編程方式執行賽格瑞做:順着接下去編程不起作用
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var btnRedirect: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.performSegueWithIdentifier("segueToSecond", sender: btnRedirect)
}
@IBAction func redirect(sender: AnyObject) {
self.performSegueWithIdentifier("segueToSecond", sender: self)
}
}
的問題是SEGUE通過點擊按鈕來執行它雖然當我嘗試做它完美以編程方式,您可以在viewDidLoad
方法中看到,它不起作用!
我已經試過通過sender
作爲nil
。
不能執行'viewDidLoad'一個SEGUE,做到在'viewDidAppear'如果你想盡快做查看屏幕 – dan
我們得到它,你的問題是關於Swift。不需要所有的帽子。 – Alexander
代碼updated.let我知道你的事情... – Joe