Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 需要帮助更改代码吗_Iphone_Xcode - Fatal编程技术网

Iphone 需要帮助更改代码吗

Iphone 需要帮助更改代码吗,iphone,xcode,Iphone,Xcode,我想将我的NSTimer代码更改为使用applicationsignificantimechange 这就是我现在拥有的 基本上我想更改计时器,而不是每5秒更改一次。例如,我希望这些文本标签在每晚12点更改。有人帮我吗 h文件 NSTimer *timer; IBOutlet UILabel *textLabel; m文件 - (void)onTimer { static int i = 0; if ( i == 0 ) { textLabel.text = @"iphone app"

我想将我的
NSTimer
代码更改为使用
applicationsignificantimechange

这就是我现在拥有的

基本上我想更改计时器,而不是每5秒更改一次。例如,我希望这些文本标签在每晚12点更改。有人帮我吗

h文件

NSTimer *timer;

IBOutlet UILabel *textLabel;
m文件

- (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];

您是否检查了
initWithFireDate:interval:target:selector:userInfo:repeats:
NSTimer的方法?单击查看更多详细信息

是的,但这并没有太大帮助。您可以向我解释一下吗?