下面是我的代码, 目前,它不工作,允许我将一个按钮连接到我的swift文件(主故事板)。此外,计时器功能不起作用,这是否与功能不起作用?
不确定如何解决此问题,如果您需要任何其他屏幕截图,请告诉我。
任何帮助将不胜感激。
由于
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var CounterLabel: UILabel!
var time = 30
var timer = Timer()
@IBAction func start(_ sender: UIButton)
{
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(ViewController.action), userInfo: nil, repeats: true)
}
func action()
{
time += 1
}
//GIFS
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.
}
}