0
我知道這種類型的問題已經提出過。我讀了很多答案。大多數有0或1票,沒有解決我的問題。我是編程新手,所以有些答案比我稍微多一點。爲了保持簡短,我的值(billAmount)在執行segue時變爲零。該SEGUE工作,並打印提供了正確的值:Segue values nil in new ViewController(Xcode 8,Swift 3)
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let segueController = segue.destination as! ResultsViewController
segueController.transferBill = "Bill: $\(billAmount)"
print(billAmount)
}
在ResultsViewController,transferBill顯示以下內容:
Bill: $
這是預期,除了billAmount不結轉。
任何幫助,非常感謝。
「我的價值正在轉向零」,哪些價值? – Sweeper
所有我轉移,包括billAmount。我爲這個問題添加了「(billAmount)」。 – CJW
transferBill是這個字符串變量嗎? – KKRocks