ios - 无法使用参数传递 Timer.sheduledTimer

标签 ios swift nstimer

basicPidTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.pidsUsage(indexPid:)), userInfo: pidsIndex, repeats: false)

//调用下面的方法但不触发任何帮助?

@objc func pidsUsage(indexPid : Int){

}

最佳答案

参数必须是Timer类型。即

@objc func pidsUsage(timer : Timer) {

}

关于ios - 无法使用参数传递 Timer.sheduledTimer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50352615/

相关文章:

ios - 有没有办法只在 VisionLabelDetector 中获得最高置信度的结果?

xcode - 如何使用 UILongPressGestureRecognizer 在用户位置上添加图钉?

ios - 弹出到 Root View 时恢复倒计时

iOS 在 UILabel 上将时间显示为分数和高分

ios - 如何获取 socket-io 断开连接的时间和在后台关闭应用程序的当前时间?

ios - Swift 2 - 定期从 slider 打印新值

ios - GMSGroundOverlay 动画 - 我应该使用 CATiledLayer 吗?

ios - 来自两个来源的冲突 CocoaPod 名称

ios - Linux APNS 服务器我应该创建哪个证书?

ios - 多次调用DispatchQueue.global(qos : . background).async会创建多线程吗?