草庐IT

timerMethod

全部标签

objective-c - 在 Swift 中使用外部参数名称时的方法签名是什么

我在我的Swift代码中使用了一个NSTimer对象,它需要将方法签名传递给它的“选择器”参数,以便循环执行所述方法。当方法签名没有外部参数名称时,即functimerMethod(internal:String){...}我可以将这个签名传递给定时器对象:vartimer=NSTimer.scheduledTimerWithTimeInterval(1.0,target:self,selector:Selector("timerMethod:"),userInfo:userInfo,repeats:true)但是,如果我给方法一个带有外部参数名的签名,比如:functimerMeth