2009-11-27 6 views

Répondre

6

Vous devrez l'implémenter vous-même en utilisant un NSTimer. Vous pouvez faire défiler les caractères de votre textLabel.text en prenant un sur le devant et en l'ajoutant à l'arrière. Pour ce faire, vous pouvez utiliser facilement une NSMutableString que vous manipuler à l'aide substringWithRange:deleteCharactersInRange: et appendString, puis définissez comme textLabel.text après chaque manipulation de caractères:

- (void)fireTimer 
{ 
    NSMutableString *mutableText = [NSMutableString stringWithString: textLabel.text]; 
    //Takes the first character and saves it into a string 
    NSString *firstCharText = [mutableText substringWithRange: NSMakeRange(0, 1)]; 
    //Removes the first character 
    [mutableText deleteCharactersInRange: NSMakeRange(0, 1)]; 
    //Adds the first character string to the initial string 
    [mutableText appendString: firstCharText]; 

    textLabel.text = mutableText; 
} 
+0

C'est une réponse parfaite –

+0

Merci pour l'indice. Travaillé comme un charme. – versatilemind

+0

Pas très lisse, mais les résultats vs les lignes de code est juste parfait! – JOM

Questions connexes