LSGMarqueeView 是用于 iOS 上的跑马灯视图。它是一个包含一个 lable
的视图扩展。我们可以通过设置 duration
变量来自定义动画持续时间,默认 duration
值为 5.0f
。
使用 CocoaPods
1. 将 pod LSGMarqueeView
添加到您的 Podfile 中。
pod 'LSGMarqueeView', '~> 2.0.0'
2. 从终端运行 pod install
,然后打开您应用的 .xcworkspace
文件以启动 Xcode。
3. 在您想使用 API 的任何地方导入 #import LSGMarqueeView.h
。
从 GitHub 人工安装
1. 在 源目录 中下载 LSGMarqueeView.h
和 LSGMarqueeView.m
文件。
2. 将这两个文件添加到您的 Xcode 项目中。
3. 在您想使用 API 的任何地方导入 #import LSGMarqueeView.h
。
示例位置
检查仓库中包含的 示例项目。它包含了一些在不同场景下使用 API 的演示。
用法
创建 LSGMarqueeView 的方法如下:
LSGMarqueeView *marqueeView = [[LSGMarqueeView alloc] initWithFrame:CGRectMake(60, 100, 200, 40)];
marqueeView.lable.text = @"Good good study day day up.It is a LSGMarqueeView demo";
marqueeView.duration = 7.0f;
marqueeView.backgroundColor = [UIColor whiteColor];
[marqueeView showInView:self.view];
MIT