开发者

Scheduling an operation (NSTimer?)

I save some images locally. The user can associates/dissociates them to some text. I would to check if an image is associated to a note and, if not, delete it开发者_开发技巧 from the local dir.

Should it better to check this every time the user dissociates the image?

or by scheduling the check?

In the second case, what could I use?


You need to create an NSTimer repeatable instance.

NSTimer* myTimer = [NSTimer scheduledTimerWithTimeInterval: 60.0 target: self
                                       selector: @selector(callAfterSixtySecond:) userInfo: nil repeats: YES];

After each 60.0 second , iOS will call the below function

-(void) callAfterSixtySecond:(NSTimer*) t 
{
    NSLog(@"Check your image here ");
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜