-
Notifications
You must be signed in to change notification settings - Fork 105
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
iOS 中的定时器 #100
Comments
使用 NSTimer 时,如何避免造成循环引用一、为什么会造成循环引用二、如何避免方法一:定义一个中间 target 给 NSTimer 持有,这个 target 再对 self 进行弱引用,从而打破循环引用
方法二:通过 block 对要执行的任务进行封装,然后再将这个 block 传进 userInfo 参数中,最后,在外面的 block 中使用时,使用 weakSelf
方法三(不推荐):如果是在 UIView 的子类中使用,可以通过重写 参考 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-performSelector:withObject:afterDelay:
The text was updated successfully, but these errors were encountered: