Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于timer的一个小细节 #1

Open
wzqcongcong opened this issue Nov 3, 2015 · 3 comments
Open

关于timer的一个小细节 #1

wzqcongcong opened this issue Nov 3, 2015 · 3 comments

Comments

@wzqcongcong
Copy link

感觉_timerOverflow是不是可以省掉啊,直接在resumeTimerWithDelay函数里面用[_timerLoop setFireDate:[NSDate dateWithTimeIntervalSinceNow: _durationOfScroll]]来设定下次的触发时间?

@Akateason
Copy link
Owner

谢谢你的提议, 但是这个我试过, 同一个作用域里不能设自两次FireDate, 后面设的无效, 所以会用了两个定时器控制, 当然, 如果你还有更好的做法, 随时通知我

@wzqcongcong
Copy link
Author

我测试了下你说的问题,连着调用2次,比如:[self.timer setFireDate:[NSDate distantFuture]]; [self.timer setFireDate:[NSDate dateWithTimeIntervalSinceNow:3]];,后面设置的会生效的,3s后就触发了。不知道你指的是这样吗?

@Akateason
Copy link
Owner

如果你多次触发这个逻辑, 会一直启动timer的, 不知道你有没有在项目demo里面调试过, 我一直滑动去调试, 过了几秒之后, scrollview会连续滚动多次, 你可以在我的demo里替换试试看

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants