登录 立即注册
金钱:

Code4App-iOS开发-iOS 开源代码库-iOS代码实例搜索-iOS特效示例-iOS代码例子下载-Code4App.com

Swift Petal is a beautiful activity indicator

[复制链接]
来自: 李世铿 分类: iOS精品源码 上传时间: 2016-5-18 12:48:05

项目介绍:

Petal
Petal 是一个漂亮的进度指示器。使用 QuartzCore 绘制。

Usage
At first, import Petal library:  (首先,导入 Petal 库)
[Objective-C] 查看源文件 复制代码
import Petal


Then just create your Petal: (创建 Petal
[Objective-C] 查看源文件 复制代码
let petal   = Petal()
petal.frame = CGRect(x: 0, y: 0, width: 200, height: 200)

view.addSubview(petal)



To update the petal number, the color of each one and the rotation duration use these properties: (以下属性可以调整花瓣的数量,也就是调整展现的块数)
[Objective-C] 查看源文件 复制代码
petal.petalCount       = 9
petal.colors           = [.redColor(), .blueColor(), .greenColor()]
petal.rotationDuration = 12



Like with an activity indicator you can update its behavior when it's stopped: (停止开关)
[Objective-C] 查看源文件 复制代码
petal.hidesWhenStopped = true


Have fun!
For more information...
To go further, take a look at the documentation and the example project.



Installation (以下描述的是安装方法。支持 CocoaPods,Carthage,Swift Package Manager

CocoaPods
Install CocoaPods if not already available: (以下两行安装 cocoapods)


[C] 查看源文件 复制代码
$ [sudo] gem install cocoapods
$ pod setup


Go to the directory of your Xcode project, and Create and Edit your Podfile and add Petal: (到自己的项目目录下,以下用MyProject做示例,添加以下语句到新建的podfile中

$ cd /path/to/MyProject
$ touch Podfile
$ edit Podfile
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

use_frameworks!
pod 'Petal', '~> 1.1.1'


Install into your project: (安装到项目中,执行以下一句)
$ pod install

Open your project in Xcode from the .xcworkspace file (not the usual project file): (打开新出现的 以 .xcworkspace结尾的项目
$ open MyProject.xcworkspace
You can now import Petal framework into your files. (完成 ……^_^)


Carthage
Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage


To integrate Petal into your Xcode project using Carthage, specify it in your Cartfile file:
github "yannickl/Petal" >= 1.1.1


Swift Package Manager
You can use The Swift Package Manager to install Petal by adding the proper description to your Package.swift file:
[Objective-C] 查看源文件 复制代码
import PackageDescription

let package = Package(
    name: "YOUR_PROJECT_NAME",
    targets: [],
    dependencies: [
        .Package(url: "https://github.com/yannickl/Petal.git", versions: "1.0.1" ..< Version.max)
    ]
)



Note that the Swift Package Manager is still in early design and development, for more infomation checkout its GitHub Page


DEMO下载:(运行demo可以查看效果,而且在demo中,针对各种文本和图文的实现都有详细的用例)






相关源码推荐:

我来说两句
*滑动验证:
所有评论(4)
doudou-wwcd 2016-5-18 14:15:14
学习学习的 支持
回复
半吱湮 2016-5-18 19:01:00
强烈支持楼主ing……
回复
bb755766428 2016-5-19 15:36:47
正需要啊,感谢楼主无私分享!
回复
0123456789ooooo 2016-5-26 10:37:31
感谢分享,Code4App有你更精彩
回复
浣溪沙 2016-5-27 19:24:58
楼主用心了,内容非常精彩。
回复
2934525789 2016-6-6 17:27:07
正需要啊,感谢楼主无私分享!
回复
yuanzhou7 2016-11-9 11:26:42
我只是路过打酱油的。
回复
yuanzhou7 2016-11-9 12:08:13
学习学习!
回复
code4app热心网友 2017-3-2 00:58:36
虽不明,但觉厉!
回复
提取码:  下载次数:6 状态:已购或VIP 售价:0(原价:10)金钱 下载权限:初级码农 
1052 0 6
联系我们
首页/微信公众账号投稿

帖子代码编辑/版权问题

QQ:435399051,742864542

如何获得代码达人称号?

代码贡献英雄榜
用户名 下载数
通过邮件订阅最新 Code4App 信息
上一条 /4 下一条
联系我们
关闭
合作电话:
13802416937
Email:
435399051@qq.com
商务市场合作/投稿
问题反馈及帮助
联系我们

广告投放| 广东互联网违法和不良信息举报中心|中国互联网举报中心|Github|申请友链|手机版|Code4App ( 粤ICP备15117877号-1 )

快速回复 返回顶部 返回列表