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 ");
}
精彩评论