Wednesday, 13 August 2014

Repeat code in certain time peroid. periodically call a method

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    [NSTimer scheduledTimerWithTimeInterval:1.0 // time in seconds
                                     target:self
                                   selector:@selector(timerFired)
                                   userInfo:nil
                                    repeats:YES];
}

- (void)timerFired{
    NSLog(@"Hello");
}

No comments:

Post a Comment