I have a label and text inside it. I want my text to move across the label's width like a digital information board. How to do that in iOS? I tried with that code (which I got from here: http://www.youtube.com/watch?v=EFoNEjPwTXM ), but it doesn't work:
In the .m file:
-(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];
In the .h file:
IBOutlet UILabel *currentSong;
IBOutlet NSTimer *timer;
-(void)time: (NSTimer *) theTimer;
@end