- 代码重点是说明NSTimer循环引用解决办法,其它方面实现比较随意。
- 在
DXTimer
类中对定时器进行初始化,控制器中只需要对DXTimer
初始化并在delloc
方法中调用DXTimer
的cleanTimer
释放定时器。 NSTimer+Block
是NSTimer
的一个分类,给NSTimer
新增了一个API,实际初始化一个定时器调用这个新的API。weakifySelf
这个宏是避免循环引用的关键。NSLog
是否打印结果很好的反映了定时器是否被释放。
Flum-X/NSTimer-ARC
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
NSTimer循环引用解决
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published