NSTimer会retain目标对象,可能会造成循环引用,请在NSTimer的基础上封装一个不retain目标对象的Timer,要求至少实现下面两个方法,并介绍设计思路。
@interface NSTimer : NSObject
+(NSTimer *)scheduledTimerWithTimeInterval:(NSTimerInterval)ti target:(id)aTarget
selector:(SEL)aSelector userInfo:(id)userinfo repeats:(BOOL)yesOrNo;
-(void)invalidate;
//other methods…
@end