我的UILAbel太长了,我希望用户可以看到它的所有内容。所以我希望我的文字从右向左移动,当歌曲在音乐应用程序中播放时,像标题一样反向移动。有什么帮助吗?
发布于 2013-07-02 01:18:19
通过创建重复触发的NSTimer来更改UILabel x的位置。当您获得计时器回调时,调整x位置:
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval: 0.5f target:self selector: @selector(bannerTimer:) userInfo: nil repeats: YES];
- (void)bannerTimer:(NSTimer *)timer
{
title.frame = CGRectOffset(title.frame, -1, 0);
// TODO Handle wrap around
}当标题需要换行时,将x设置为设备的宽度。或者,通过增加x位置使其向右移动。
https://stackoverflow.com/questions/17409887
复制相似问题