iphone - 每 n 分钟在标签中显示 NSString

标签 iphone ios sleep

我有一个标签和一个由 10 个字符串值组成的数组。我知道如何在该标签中显示文本。但是现在,每 1 分钟我想显示该数组中的每个字符串到标签.知道怎么做吗?

最佳答案

使用 NSTimer

NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(changeText:) userInfo:nil repeats:YES];

如果要停止计时器,请记住使用[timer invalidate],否则如果目标已被释放,您将崩溃。

关于iphone - 每 n 分钟在标签中显示 NSString,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10315038/

相关文章:

ios - 如何在 swift 中使用 NSFont?

ios - 在预构建阶段为多个目标选择不同的图像源

linux - 英特尔 gcc 中的 _mm_pause 用法

Android 开发 : Thread. sleep just slow down game

ios - iPhone 上未触发选择(适用于 iPad)

iphone - COLLATE 为 Coredata 创建的 INDEX

iphone - 以编程方式关闭 UIAlertView

iphone - 绘制层 :inContext is not called

ios - 我是否需要为不同类型的注释创建实现 MKAnnotation 协议(protocol)的类?

Java - 访问静态方法 sleep - 怎么了?