iOS 跑马灯效果 野性酷女 2022-08-13 18:39 178阅读 0赞 ## 做项目的项目的时候,用到了标题滚动的效果(银行,商铺门面上悬挂的电子屏幕滚动信息),找了一下。 写出来分享给大家 1.首先下载这个类文件[下载地址][Link 1] 2. ## 只需要将这几行代码添加上,并且添加到你需要滚动的视图上,(注意:滚动的字体长度一定要长于你设定的view长度) self . content = \[\[ MarqueeLabel alloc \] initWithFrame : CGRectMake ( 0 , 20 , 50 , 40 )\]; self . content . marqueeType = MLContinuous ; self . content . textColor = \[ UIColor whiteColor \]; self . content . scrollDuration = 3.0 ; self . content . animationCurve = UIViewAnimationOptionCurveEaseInOut ; self . content . fadeLength = 5.0f ; self . content . continuousMarqueeExtraBuffer = 5.0f ; self . content . text = @“啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊”; self . content . tag = 101 ; self . navigationItem . titleView = self . content ; //\[self.view addSubview:self.content\]; [Link 1]: http://download.csdn.net/detail/duoduo_333/8141109
还没有评论,来说两句吧...