How would you achieve a LED Scrolling effect?
How would you achieve an LED Scrolling effect like the example below?
LED Sign - LED Ticker emulator for the iPhone and iPad http://img.skit开发者_C百科ch.com/20101201-rsfh4p1bajb1wp94k466pdpiuj.preview.jpgsometimes it remunerates to comment in other posts :)
Have put some code together for you, but you should implement the font '8Pin Matrix'
to get realistic feeling.
UILabel *label;
- (void)viewDidLoad {
[super viewDidLoad];
label = [[UILabel alloc]initWithFrame:CGRectMake(10, 50, 300, 20)];
label.font = [UIFont fontWithName:@"Courier-Bold" size:16.0];
label.backgroundColor = [UIColor blackColor];
label.textColor = [UIColor greenColor];
label.lineBreakMode = UILineBreakModeCharacterWrap; // otherwise you would get "…"
label.text = @"This LED Text will be scrolled "; // some blanks to get space between
[self.view addSubview:label];
[NSTimer scheduledTimerWithTimeInterval:0.12f target:self
selector:@selector(scrollLabel)
userInfo:nil repeats:YES];
}
- (void)scrollLabel {
label.text = [NSString stringWithFormat:@"%@%@", [label.text substringFromIndex:1], [label.text substringToIndex:1]];
}
精彩评论