我需要使用@"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之后没有其他符号时,xcode才会删除“多余”空格。
最佳答案
如果用Unicode不可破坏的空格@" "
(在Mac上由Alt-space获取)替换空格@" "
怎么办?
关于iphone - iOS 7多空格问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19176497/