如何在Swift中设置 target (调用类级别函数),方法是在obj-c中完成:
答案 0 :(得分:12)
class MyClass: NSObject{
class func startTimer(){
NSTimer.scheduledTimerWithTimeInterval(2.0, target: MyClass.self, selector: "callByTimer:", userInfo: nil, repeats: true)
}
class func callByTimer(timer: NSTimer!){
println("Called")
}
}
MyClass.startTimer()