我有一个像走马灯一样的UILabel,每0.09秒文本就会改变,但当最后一个字符是空格时,它会被裁剪掉,导致走马灯效果看起来很卡顿。
以下是代码:
[self setTickerLabel: [ [UILabel alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height - 40, self.view.bounds.size.width, 40)]];
[self.tickerLabel setFont:[UIFont fontWithName:@"Courier" size:TICKER_FONT_SIZE]];
self.text =[NSString stringWithFormat:@"%@",self.result];
self.tickerLabel.textAlignment = NSTextAlignmentRight;
[self.tickerLabel setText:self.text];
[self.tickerLabel setLineBreakMode:NSLineBreakByWordWrapping];
[NSTimer scheduledTimerWithTimeInterval:TICKER_RATE target:self selector: @selector(nudgeTicker:) userInfo:nil repeats:YES];
[self.view addSubview:self.tickerLabel];
nudge Ticker方法的作用如下:
NSString* firstLetter = [self.text substringWithRange: NSMakeRange(0,1)];
NSString* remainder = [self.text substringWithRange:NSMakeRange(1,[self.text length]-1)];
self.text=[remainder stringByAppendingString: firstLetter];
self.tickerLabel.text=self.text;
我真的需要帮助。我该怎么解决这个问题?顺便说一下,UILabel 的文本是阿拉伯语。