Reputation: 17585
I've used UILabel
for showing text with vertical alignment
. I'm showing text as character by character with vertical alignment. Actually It's an moving text by alignment with CABasicAnimation
. But my problem here is
show one character
, but when I try stretch label width to
show single character, Some character is wiped partially. see screen
shot of xib(sample with small text).. Or try to extend frame size, some row show single character and some shows double character.How can I fix it with my xib? Answer also acceptable with programmatically.
Note: Text used in this example "Some text with long".
Upvotes: 2
Views: 218
Reputation: 5845
You don't need vertical align. Just make the UILabel wider and input a \n after every character of the string.
NSString *longString = @"This is a very very long string";
NSString *labelString = @"";
self.label.text = labelString;
self.label.numberOfLines = 500; //just put a big number or calculate something
for (int n=longString.length - 1; n > -1; --n) {
labelString = [NSString stringWithFormat:@"%@\n%@", [longString substringWithRange:NSMakeRange(n, 1)], labelString];
self.label.text = labelString;
}
Upvotes: 1