在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/