想要将我的NSTimer代码更改为使用applicationSignificantTimeChange
这就是我现在所拥有的.
基本上我想更改计时器,而不是每5秒更换一次,例如我希望这些textLabels每天晚上12点更改,有人帮我解决?
//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];
Run Code Online (Sandbox Code Playgroud)