ラベルテキストをアニメーション化する必要があります@"text . ", @"text . ", @"text . ", @"text ."
したがって、ユーザーにはドット アニメーションのみが表示されます。ラベル テキストには中央揃えを使用します。
そのためにタイマーを使用します。
- (void)processTimerFired:(NSTimer *)timer {
NSMutableDictionary *dict = [timer userInfo];
NSMutableString *string = [[dict objectForKey:@"label"] mutableCopy];
int dotNumber = [[dict objectForKey:@"dot"] intValue];
if (dotNumber == 3) {
dotNumber = 1;
}
else {
dotNumber += 1;
}
[dict setObject:@(dotNumber) forKey:@"dot"];
for (int i = 1; i < 4; i++) {
if (i == dotNumber) {
[string appendString:@"."];
}
else {
[string appendString:@" "];
}
}
self.informationLabel.text = string;
}
iOS 6 ではすべて問題ありませんが、iOS 7 では xcode がスペースの数を減らしているように見えるため、テキストの出所が常に異なります。そのため、テキストが揺れているように見えます。
テスト用に最後に「+」をつけてみました。そして、すべてがOKになりました。そのため、その後に他のシンボルがない場合にのみ、xcode は「余分な」スペースを削除するようです。