不能在IBAction内部使用变量

时间:2015-07-30 08:37:47

标签: ios xcode

不能在其外部的IBAction中使用变量

代码:

if timerRunning==true && timerCount==actualWorkoutLength {
    timer.invalidate()
    timerRunning = false
    timerCount=0
    timerLabel.text="0 secs"
    intervalAlert()
}

屏幕截图:http://i.gyazo.com/86e0143893413c2dd50d59ecba7cf460.png

1 个答案:

答案 0 :(得分:0)

我查看截图,actualWorkoutLength是另一种方法的局部变量。

顺便说一句:在startButton(sender: UIButton)你永远不会看到它。

如果你想看到它。将actualWorkoutLength声明为global variable