ver*_*ind 5 iphone uitableview
有没有办法为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;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1584 次 |
| 最近记录: |