UitableViewCells TextLabel.text의 Marquee Effect
-
05-07-2019 - |
문제
UitableViewCells TextLabel.text에 대한 HTML Marquee 효과와 같은 것을 달성 할 수있는 방법이 있습니까?
해결책
Nstimer를 사용하여 직접 구현해야합니다. 당신은 당신의 캐릭터를주기 할 것입니다 textLabel.text
전면에서 하나를 가져 와서 뒷면에 추가함으로써. 이것을 쉽게하기 위해 당신은 NSMutableString
당신이 사용을 조작 할 것입니다 substringWithRange:
deleteCharactersInRange:
그리고 appendString
, 다음으로 설정합니다 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;
}
제휴하지 않습니다 StackOverflow