-1
스톱워치 앱을 만드는 중입니다. 앱에서 시작 버튼을 누르는 대신 몇 가지 이유가 있습니다. 그 대신 1,2,3,4,5 등이 있습니다. '<' . 코드를 살펴 봤지만 아무것도 찾을 수 없습니다.스톱워치 코드 문제
class ViewController: UIViewController {
var timer = NSTimer()
var time = 0
func result() {
time + 1
timeLabel.text = "\(timer)"
}
@IBOutlet var timeLabel: UILabel!
@IBAction func stop(sender: AnyObject) {
timer.invalidate()
time = 0
timeLabel.text = "0"
}
@IBAction func timeButton(sender: AnyObject) {
timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("result"), userInfo: nil, repeats: true)
}
}
당신은 당신의'timeLabel.text = "\ (타이머)"오타가''timeLabel.text = "\ (시간)" '이어야한다. – vacawama
그리고'time + 1'은'time + = 1'이어야합니다. – vacawama
아직도 작동하지 않습니다 – Ploostic