寫一個簡單的函式,計算按鈕點選次數,來改變圖片
(採用字串,來改變檔案的file名稱),簡單的功能卻很有實作的感覺,哈哈!
延伸閱讀:NSTimer
http://ios-blog.co.uk/tutorials/swift-nstimer-tutorial-lets-create-a-counter-application/#whatIsNSTimer
筆記:另一種倒數計時歸零的寫法
1
2 3 4 5 |
@IBAction func clearButton(sender: AnyObject) {
timer.invalidate() counter = 0 countingLabel.text = String(counter) } |
沒有留言:
張貼留言
歡迎網友的交流與分享,謝謝。