I have a UILabel acting like a ticker so every 0.09 seconds the text is being changed, but when a space comes at the end of the label it is being trimmed, so it is looking like the ticker is lagging.
Here’s the code:
[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];
The nudge Ticker method does the following:
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;
I really need some help. How can I fix this? By the way the text of the UILabel is in Arabic.