Curtain 1.3

Curtain 1.3

Igor Squadra维护。



  • igorsquadra

Curtain Logo

Swift 5.0 Version Carthage Compatible Platform


Curtain 是一个 Swift pod,可以帮助您实现计时器背景动画。实现起来非常简单,使用提供的选项来自定义背景颜色、背景填充方向和退出动画。

示例

Example Application Screenshot

Example Application Screenshot

使用 Curtain 来动画化您的计时器。自定义您的退出动画和背景颜色来提供更好的用户体验。支持垂直和水平两种方向。

安装

CocoaPods

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

pod 'Curtain'

Carthage

Carthage 是一个去中心化的依赖管理器,构建您的依赖并提供二进制框架。

为了使用Carthage将 Curtain 集成到您的Xcode项目中,在您的 Cartfile 中指定它

github "igorsquadra/Curtain"

运行 carthage update --platform iOS 来构建框架,然后将从 Curtain.framework 拖到您的Xcode项目中。

在您的目标应用程序的“构建阶段”设置选项卡中,点击“+”图标,选择“新建运行脚本阶段”,并将框架路径添加如下所述,见Carthage 快速开始步骤 4、5和6

使用方法

要实现Curtain,创建一个BackgroundProgressView并将其添加为子视图。

import Curtain

// Initialize the progress view.
var backgroundProgressView: BackgroundProgressView!
backgroundProgressView = BackgroundProgressView.init(frame:
    CGRect.init(
        x: 0,
        y: 0,
        width: 0,
        height: 0
))

// Add it as subview.
view.addSubview(backgroundProgressView)

使用setup方法自定义以下参数

// Setup your progress view.
backgroundProgressView.setup(
    withDirection: .vertical, // Direction type should be .horizontal or .vertical.
    withTime: 15.0,
    view: view.frame,
    color: UIColor.init(red: 109/255, green: 212/255, blue: 0/255, alpha: 1.0),
    initialSize: 0, // Set initial size, default is 0.
    autoreset: true, // If false the progress view remains full at the end of timer.
    resetType: .linear // The reset animation should be .linear or .fade
)

调用start方法以开始动画。使用time参数以新时间开始动画(如果为nil,则使用在setup方法中传递的时间)。

// Start progress animation
backgroundProgressView.start(withTime: 35.0)

使用reset方法将进度视图重置为动画状态。

// Reset progress animation
backgroundProgressView.reset()

贡献

欢迎贡献🚀

许可协议

Curtain
Copyright (c) 2020 igorsquadra <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.