本文主要是介绍iOS开发之跑马灯,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.法一:
类似于弹幕,一个label的实现
- (void)viewDidLoad {
[super viewDidLoad];[self addPaomaLabel];
}
- (void)addPaomaLabel {
self.annonLabel = [[UILabel alloc]initWithFrame:CGRectMake(45, 8, ScreenWidth-45, 30)];
self.annonLabel.text = @"哈哈哈哈带我逃跑吧的简书哈哈哈哈哈今年的目标要减肥哈哈哈";
self.annonLabel.font = [UIFont systemFontOfSize:14.0f];
self.annonLabel.textColor = [UIColor grayColor];
self.annonLabel.numberOfLines = 1;
[self.annonLabel sizeToFit];[self.backView addSubview:self.annonLabel];
[self.backView sendSubviewToBack:self.annonLabel];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];self.annonLabel.center = CGPointMake(self.view.bounds
这篇关于iOS开发之跑马灯的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!