我有一个 UILabel,我想像 HTML 中的 marquee 标签一样滚动,我应该怎么做?
#define LEFTSCROLLDIRECTION 0
#define RIGHTSCROLLDIRECTION 1
MarqueeLabel *marquee = [[MarqueeLabel alloc] initWithFrame:CGRectMake(10, 10, 300, 30)];
label.scrollDirection = LEFTSCROLLDIRECTION;
[self.view addSubview:marquee];
编辑
我发现这门课一开始似乎有效..
但这有一个错误..如果我在 UINavigationController 中向前导航并在一段时间后弹出 pushViewController,则 autoScrollLabel 停止动画..
AutoScrollLabel *autoScrollLabel = [[AutoScrollLabel alloc] init];
autoScrollLabel.text = @"Hi Mom! How are you? I really ought to write more often.";
autoScrollLabel.textColor = [UIColor yellowColor];