我无法让计时器在Swift中工作,请帮忙。我收到错误extra 'selector' in call
。
var timer = NSTimer.scheduledTimerWithTimeInterval(
1,
target: self,
selector: Selector ("result"),
userInfo: nil,
repeats: true
)
答案 0 :(得分:1)
改为使用
var timer = NSTimer.scheduledTimerWithTimeInterval (
1,
target: self,
selector: "result",
userInfo: nil,
repeats: true
)
答案 1 :(得分:0)
我写的方法之一:
override func viewDidLoad() {
super.viewDidLoad()
let aSelector : Selector = "updateTime"
let timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: aSelector, userInfo: nil, repeats: true)
}
func updateTime() {
}