Highlight effect in uitableviewcells textlabel.text

Is there a way to accomplish something like the Marquee html effect for uitableviewcells textlabel.text?

+5
source share
1 answer

You will need to implement it yourself using NSTimer. You will be quoted through your characters textLabel.text, taking one from the front and adding it back. To make this easy, you can use NSMutableStringthat you could manipulate with substringWithRange: deleteCharactersInRange:and appendString, and then after <character manipulation> set textLabel.text:

- (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;
}
+6
source

All Articles