這是我第一次做ios項目,每次我嘗試運行這個應用程序,它卡在白色屏幕上。任何想法或解決這個問題,將不勝感激。我不知道它的代碼的錯誤還是模擬器。我的應用程序被困在一個白色的屏幕上,說着版權的東西,當我在ios模擬器中運行它
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var mySwitch: UISwitch!
@IBOutlet var Answer: UILabel!
@IBOutlet var tempInput: UITextField!
//aqnswer value
@IBAction func switchPressed(sender: AnyObject)
{
if (mySwitch.on) {
self.Answer.text = "cel to fah"
}
else
{
self.Answer.text = "fah to cel"
}
}
//textfield value
@IBAction func calculate(sender: AnyObject)
{
//get user input
// value = celcius
var Value:Int = tempInput.text.toInt()!
var toFah :Int = (32 + Value * 9)/5
//to celcius
var toCel: Int = (Value-32) * 5/9
if (mySwitch.on)
{
self.Answer.text = toFah.description
}
else {
self.Answer.text = toCel.description
}
// println(fah)
// Answer.text = fah.description
}
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.
}
}
你得到的錯誤是什麼?是否有任何錯誤日誌在控制檯? –
我越來越「終止與未捕獲的類型NES excption的例外 –