iphone App中的字符串幻灯片



是否有任何方法的幻灯片显示字符串数组在UILabel在iphone应用程序?(即字符串将一个接一个地出现)。谁来帮帮我。

看看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];
}

不,没有。但是,好消息是,它应该是微不足道的实现。我建议创建一个子类的uilabel有一个字符串数组作为ivar。子类有一个初始化方法来设置数组和时间间隔。然后它使用一个定时器来改变它的标签并重新显示它自己。好运!

最新更新