-2
@IBOutlet weak var textBox: UITextField!
@IBOutlet weak var result: UILabel!
@IBAction func calculate(sender: AnyObject) {
var age = textBox.text.toInt()
var Years = age! * 7
result.text = "your cat is "+ catYears + "cat years old"//cat years is an int who do i print it
}
所以在將textBox轉換爲整數後如何以整數形式打印它。如何在Swift中打印整數
什麼!沒有它不是 –
你不能降低它的假設 –
只是'println(catYears)'。或者看看:'println(「Cat Years:\(catYears)」)' – zaph