需要帮助改变代码

时间:2010-11-10 06:22:14

标签: iphone xcode

我想将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];

1 个答案:

答案 0 :(得分:1)

您是否检查了initWithFireDate:interval:target:selector:userInfo:repeats:的{​​{1}}方法?点击here了解详情

相关问题