Snippet
In order to create a rotating banner marquee on screen we can use a label along with help of core animation to achieve the effect as follows. The location of the text and duration can be controlled by changing the frame co-ordintes. In the below example the text moves from right to left side of the screen.
- UILabel* lblTime =[[UILabel alloc] initWithFrame:CGRectMake(900, 0, 235, 19)];
- [lblTime setBackgroundColor:[UIColor clearColor]];
- [self.view addSubview:lblTime];
- [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDuration:20];
- [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.view cache:YES];
- [lblTime setText:@"Now Available in Appstore!"];
- [lblTime setTextAlignment:UITextAlignmentLeft];
- lblTime.frame = CGRectMake(-300, 0, 235, 19);
- [UIView commitAnimations];
<!--break-->