uitableviewcellsのマーキー効果textlabel.text
-
05-07-2019 - |
質問
uitableviewcells textlabel.textのhtmlマーキー効果のような何かを達成する方法はありますか?
解決
NSTimerを使用して自分で実装する必要があります。 textLabel.text
の文字を、前面から1つずつ取り出して背面に追加することにより、循環させます。これを簡単に行うには、 substringWithRange:
deleteCharactersInRange:
および appendString
を使用して操作する NSMutableString
を使用できます。 、そして各文字操作の後に textLabel.text
として設定します:
- (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;
}
所属していません StackOverflow