Ich habe Slider in meiner App erstellt. Wie man Schleife in meinem Code hinzufügt. Weil mein Etikett Text nur einmal rutscht, aber ich möchte Text wiederholen (Schleife) auf dem Etikett. Wie es möglich ist?Wie erstelle ich Etiketten-Schieberegler
My Label Schieber Code
globalCounter Stellen als globale Variable
globalCounter=0;
if(nameArray.count>0){
[self changeLable];
}
Dann
-(void)changeLable{
if(!(globalCounter<nameArray.count)){
return;
}
NSLog(@"globalCounter %d",globalCounter);
[UIView animateWithDuration:1
delay:0.5
options: UIViewAnimationOptionTransitionCrossDissolve
animations:^{
}
completion:^(BOOL finished) {
[lblTitle setText:[nameArray objectAtIndex:globalCounter]];
globalCounter++;
[self performSelector:@selector(changeLable) withObject:nil afterDelay:1];
}];
}
bearbeiten
-(void)changeLable{
if(!(globalCounter<nameArray.count)){
globalCounter=0;
}
NSLog(@"globalCounter %d",globalCounter);
[UIView animateWithDuration:1
delay:0.5
options: UIViewAnimationOptionTransitionCrossDissolve
animations:^{
}
completion:^(BOOL finished) {
[lblTitle setText:[nameArray objectAtIndex:globalCounter]];
globalCounter++;
[self performSelector:@selector(changeLable) withObject:nil afterDelay:1];
}];
}
Verwendung Web-Ansicht statt Etikett und anwenden Marquee Effekt auf Ihren Text mit HTML-Syntax –
Verwenden [MarqueeLabel] (https://github.com/cbpowell/MarqueeLabel) – pkc456
http://stackoverflow.com/questions/22397122/how-to-move-Text-von-rechts nach-links-in-ios-programmatisch/22397613 # 22397613 –