Giter Club home page Giter Club logo

gradientprogressview's Introduction

GradientProgressView

一个简单的进度条控件

示例图

example

  • 支持设置纯色进度条、渐变进度条
  • 支持设置进度条的圆角
  • 支持设置进度条的内间距
  • 支持自定义高度、背景颜色
  • 支持设置动画时长、动画时间函数
  • 支持监听进度的更新回调

要求

  • Swift 5.0
  • Xcode 11
  • iOS 8.0+

使用

设置圆角

//设置进度条圆角
progressView.progressCornerRadius = 5

设置内间距

//设置内间距
progressView.progressEdgeInsets = UIEdgeInsets(top: 4, left: 5, bottom: 4, right: 5)

设置纯色和渐变色

//设置纯色和渐变色
progressView1.progressColors = [.green]
progressView2.progressColors = [.green, .red]

设置动画时间时长

//动画时间
progressView.animationDuration = 1

设置动画时间函数

//动画时间函数
progressView.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut)

设置动画更新回调

//动画更新回调
progressView.progressUpdating = {[unowned self] progress, frame in
    //在这里可以获得当前的进度百分比和进度条的frame
    print(progress)
    print(frame)
}

设置进度

//设置进度
progressView.setProgress(0.8, animated: true)

集成

CocoaPods
pod 'KFGradientProgressView'
Swift Package Manager
dependencies: [
    .package(url: "https://github.com/moliya/GradientProgressView", from: "1.4.0")
]

gradientprogressview's People

Contributors

moliya avatar

Stargazers

XYZTech avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.