Hank22
Hank22

Reputation: 1

Need help changing code

I want to change my NSTimer code to to use applicationSignificantTimeChange

This is what I have right now.

Basically I want to change the timer, instead of changing every 5 seconds for example I want these textLabels to change at 12am every night anyone help me out?

h file

NSTimer *timer;

IBOutlet UILabel *textLabel;

m file

- (void)onTimer {

static int i = 0;

if ( i == 0 ) { 
textLabel.text = @"iphone app";
}

else if ( i == 1 ) {
textLabel.text = @" Great App!";
}

else if ( i == 2 ) {
textLabel.text = @" WOW!";
}

else {
textLabel.text = @" great application again!!";
i = -1;
}

i++;
}


timer =[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(onTimer) userInfo:nil repeats:YES];

Upvotes: 0

Views: 49

Answers (1)

Pablo
Pablo

Reputation: 29519

Did you check initWithFireDate:interval:target:selector:userInfo:repeats: method of NSTimer? Click here for more details

Upvotes: 1

Related Questions