我遇到了我的應用程序的問題。我試圖在按一個按鈕後在文本框中輸入的內容的15%顯示在標籤中。這是我到目前爲止的代碼:小費計算器 - 意外地發現零,同時展開一個可選值
@IBAction func calculateButton(sender: UIButton)
{
var fifteenPercent: Double
fifteenPercent = 0.15
var billTop = billTextField.text.toInt()!
var billTipped: Double
billTipped = Double(billTop) * fifteenPercent
tipAmountLabel.text = "$\(billTipped)"
當我啓動應用程序,並按下按鈕,我得到的錯誤
fatal error: unexpectedly found nil while unwrapping an Optional value (lldb)
可我知道什麼是您的Xcode版本 –
的Xcode版本:版本6.4(6E35b) – ABlach