iOS scrolling label quickly implements the source code. Here the two labels used, move the frame implementation. Simple to use.
-(void) viewdidload {[Super viewdidload]; Additional setup after loading the view, typically from a nib. NSString *str = @ "I Love you,ios-text scrolling label!"; Self.scrolllabel = [[UILabel alloc] Initwithframe:cgrectmake (0,100,self.view.frame.size.width, 44)]; Self.scrollLabel.text = str; [Self.view AddSubview:self.scrollLabel]; Self.secondlabel = [[UILabel alloc] Initwithframe:cgrectmake (self.scrolllabel.frame.origin.x+ Self.scrollLabel.frame.size.width, SELF.SCROLLLABEL.FRAME.ORIGIN.Y, Self.scrollLabel.frame.size.width, Self.scrollLabel.frame.size.height)]; Self.secondLabel.font = Self.scrollLabel.font; Self.secondLabel.text = Self.scrollLabel.text; [Self.view AddSubview:self.secondLabel]; [Self addanimation];//[[nstimer scheduledtimerwithtimeinterval:2 target:self selector: @selector (addanimation) Userinfo:nil Repeats:yes] fire];} -(void) addanimation{cgrect scrollframe = self.scrollLabel.frame; CGRect Secondframe = Self.secondLabel.frame; [UIView animatewithduration:4 delay:0 options:uiviewanimationoptioncurvelinear animations:^{self.scrollLabel.frame = CGRectMake (-self.scrolllabel.frame.size.width, SELF.SCROLLLABEL.FRAME.ORIGIN.Y, Self.scrollLabel.frame.size.width, Self.scrollLabel.frame.size.height); Self.secondLabel.frame = CGRectMake (0, SELF.SECONDLABEL.FRAME.ORIGIN.Y, Self.secondLabel.frame.size.width, Self.secondLabel.frame.size.height); } completion:^ (BOOL finished) {self.scrollLabel.frame = Scrollframe; Self.secondLabel.frame = Secondframe; [Self addanimation]; }];}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
IOS scrolling label (LED, marquee, etc.) fast realization of source code