开发者

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.jpg


sometimes 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]];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜