ios - iphone App 中字符串的幻灯片放映

标签 ios xcode ios4

在iphone app中,UILabel中的字符串数组是否有幻灯片放映的方法?(即,字符串将一个接一个地出现)。任何人都请帮助我。

最佳答案

NSTimer .

这可以让您每 X 秒重复一次回调。您可以使用它来交换数组中的字符串。

[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(swapStrings:) userInfo:nil repeats:YES];

_myStrings = @[ @"a" , @"b", ..... ];

... 

- (void) swapStirings:(id)sender 
{
    myInt ++;
    if (myInt >= [_myStrings count]) myInt = 0;
    myLabel.text = [_myStrings objectAtIndex:myInt];
}

关于ios - iphone App 中字符串的幻灯片放映,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14254947/

相关文章:

iphone - 支持 iOS 4.3 到 iOS 6.0

ios - UITableView 刷新时无法滚动

objective-c - 从子类 WebView 更改 Window 的元素可见性

xcode - 我可以找出主动登录的 GameCenter 用户名吗?

iphone - 在后台播放 AVAudioPlayer 的一个实例

iOS - 我丢失了 APNs key 文件会怎样?

ios - SwiftUI/Combine 没有从 @Published 更新到 @ObservedObject

iOS - 更改语言后不应用默认值

xcode - 下载 xcode 文档失败

objective-c - 以...打开 html 页面(在 Safari 中)