小编Bas*_*App的帖子

帮助更改textLabel的NSTimer.代码包括在内

想要将我的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)

iphone xcode

2
推荐指数
1
解决办法
1654
查看次数

标签 统计

iphone ×1

xcode ×1