iphone-common-codes-ccteam源代码 CCNSTimer.m

//
// CCNSTimer.m
// CCFC
//
// Created by xichen on 11-12-28.
// Copyright 2011 ccteam. All rights reserved.
//


#import "CCNSTimer.h"




@implementation NSTimer(cc)


// create a common timer
+ (NSTimer *)createCommonTimer:(id)target sel:(SEL)sel timeInterval:(NSTimeInterval)interval
{
return [NSTimer scheduledTimerWithTimeInterval:interval
target:target
selector:sel
userInfo:nil
repeats:NO];
}


// create a common repeatable timer
+ (NSTimer *)createCommonRepeatTimer:(id)target sel:(SEL)sel timeInterval:(NSTimeInterval)interval
{
return [NSTimer scheduledTimerWithTimeInterval:interval
target:target
selector:sel
userInfo:nil
repeats:YES];
}


// safe invalidate
- (void)safeInvalidate
{
[self invalidate];
self = nil;
}


@end

 

可能有更新:

 googlecode链接地址:http://code.google.com/p/iphone-common-codes-ccteam/source/browse/trunk/CCFC/files/CCNSTimer.m

 github地址: https://github.com/cxsjabc/iphone-common-codes-ccteam/tree/master/CCFC/files/CCNSTimer.m

 

posted @ 2012-01-02 15:30  cc_team  阅读(163)  评论(0编辑  收藏  举报