MKSHorizontalLineProgressView 版本 0.1.1

MKSHorizontalLineProgressView 版本 0.1.1

测试已测试
语言语言 Obj-CObjective C
许可 MIT
发布最新发布2016年6月

kamarshad 维护。



示例

要运行示例项目,请克隆仓库,并首先从 Example 目录运行 pod install

要求

代码在 iOS 7 及以上版本上运行良好!

安装

使用 Cocoa Pod

MKSHorizontalLineProgressView 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中即可

pod 'MKSHorizontalLineProgressView'

并按照“在您的 iOS 应用中使用”部分中提到的步骤进行

手动

  1. 将 MKSHorizontalLineProgressView 类拖放到您的类组文件夹中
  2. 按照“在您的 iOS 应用中使用”部分中提到的步骤进行

在 iOS 应用中使用

  1. 导入头文件 #import "MKSHorizontalLineProgressView.h"
  2. 由于它是 UIView 的子类,您必须创建其实例并在当前父视图上添加它,在这个演示中我们使用 Storyboard 创建视图。在这种情况下创建 IBOutlet 引用

    @property (weak, nonatomic) IBOutlet MKSHorizontalLineProgressView *horizontalLineProgressView2

  3. 根据您的需求编写初始设置代码(查看示例调用)

  • (void)doIntialSetup{

    //带有百分比文本的水平线

    self.horizontalLineProgressView1.progressValue = 49.0f;
    self.horizontalLineProgressView1.trackColor = [UIColor colorWithRed:34.0f/255.0f green:34.0f/255.0f blue:34.0f/255.0f alpha:1.0f];
    self.horizontalLineProgressView1.barColor = [UIColor colorWithRed:58.0/255.0 green:170.0/255.0 blue:53.0/255.0 alpha:1];
    self.horizontalLineProgressView1.barThickness = self.horizontalLineProgressView1.frame.size.height;
    self.horizontalLineProgressView1.showPercentageText = YES; 
    
    //Second Horizontal line with percentage text
    self.horizontalLineProgressView2.progressValue = 78.0f;
    self.horizontalLineProgressView2.trackColor = [UIColor blackColor];
    self.horizontalLineProgressView2.barColor = [UIColor colorWithRed:0.0f / 255.0f green:75.0f / 255.0f blue:125.0f / 255.0f alpha:1.0f];
    self.horizontalLineProgressView2.barThickness = self.horizontalLineProgressView2.frame.size.height;
    self.horizontalLineProgressView2.showPercentageText = YES;
    
    //Horizontal line without percentage text
    self.horizontalLineProgressView3.progressValue = 28.0f;
    self.horizontalLineProgressView3.trackColor = [UIColor blackColor];
    self.horizontalLineProgressView3.barColor = [UIColor colorWithRed:200.0f / 255.0f green:16.0f / 255.0f blue:46.0f / 255.0f alpha:1.0f];
    self.horizontalLineProgressView3.barThickness = self.horizontalLineProgressView3.frame.size.height;
    

    }

进一步扩展

未来发布待办事项!

  1. 将来将添加垂直线进度条
  2. 还将提供选项以显示带有平滑动画的线进度视图
  3. 建议最受欢迎:)

作者

kamar shad, [email protected]

这是仓库 https://github.com/bphenriques/HorizontalProgressView 的几乎复制品

许可

MKSHorizontalLineProgressView 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。