Is there a way to accomplish something like the html Marquee effect for a uitableviewcells textlabel.text?
+6
A:
You'll have to implement it yourself using a NSTimer. You would cycle trough the characters of your textLabel.text
by taking one from the front and appending it to the back. In order to do this easily you could use a NSMutableString
that you would manipulate using substringWithRange:
deleteCharactersInRange:
and appendString
, and then set as textLabel.text
after each character manipulation:
- (void)fireTimer
{
NSMutableString *mutableText = [NSMutableString stringWithString: textLabel.text];
//Takes the first character and saves it into a string
NSString *firstCharText = [mutableText substringWithRange: NSMakeRange(0, 1)];
//Removes the first character
[mutableText deleteCharactersInRange: NSMakeRange(0, 1)];
//Adds the first character string to the initial string
[mutableText appendString: firstCharText];
textLabel.text = mutableText;
}
luvieere
2009-11-27 14:55:23
That's a perfect answer
ahmet emrah
2009-11-27 15:21:57
Thanks for the hint. Worked like a charme.
versatilemind
2009-11-27 17:01:37
Not very smooth, but results vs. lines of code is just perfect!
JOM
2010-02-02 08:22:28