У меня есть ярлык и текст внутри него. Я хочу, чтобы мой текст перемещался по ширине этикетки, как цифровая информационная доска. Как это сделать в iOS? Я попытался использовать этот код (который я получил здесь: http://www.youtube.com/watch?v=EFoNEjPwTXM ), но это не работает:
В файле .m:
-(void)time: (NSTimer *) theTimer
{
currentSong.center = CGPointMake(currentSong.center.x - 3.5, currentSong.center.y);
if (currentSong.center.x < - (currentSong.bounds.size.width/2))
{
currentSong.center = CGPointMake (320 + (currentSong.bounds.size.width/2), currentSong.center.y);
}
}
In viewDidLoad
:
timer = [NSTimer timerWithTimeInterval:0.09 target:self selector:@selector(time:) userInfo:nil repeats:YES];
В файле .h:
IBOutlet UILabel *currentSong;
IBOutlet NSTimer *timer;
-(void)time: (NSTimer *) theTimer;
@end