首页 > 解决方案 > 带两位小数的定时定时器

问题描述

是否可以使用带有两位小数的 schedulerTimer

让 timer = Timer.scheduledTimer(timeInterval: 0.10 , target: self, selector: #selector(fireTimer), userInfo: nil, repeats: true)

时间间隔为 0.10

标签: iosswiftuikit

解决方案


确实。

请注意,该方法中的timeInterval参数scheduedTimer描述为:

计时器触发之间的秒数。如果ti小于或等于 0.0,则此方法选择 0.1 毫秒的非负值。

文档: https ://developer.apple.com/documentation/foundation/timer/1412416-scheduledtimer


推荐阅读