Pergunta

Existe uma maneira de fazer algo parecido com o efeito Marquee html para uma textlabel.text UITableViewCells?

Foi útil?

Solução

Você vai ter que implementá-lo usando um NSTimer. Você faria ciclo trough os personagens de seu textLabel.text tomando uma de frente e acrescentá-lo para trás. A fim de fazer isso facilmente você poderia usar um NSMutableString que você manipular usando substringWithRange: deleteCharactersInRange: e appendString e defina como textLabel.text após cada manipulação de caracteres:

- (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;
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top