登录 立即注册
金钱:

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

Swift写的评分控件

[复制链接]
来自: 后知后觉乀 分类: iOS精品源码 上传时间: 2016-12-22 17:39:40
Tag:评分 Rating 滑杆 slider 星级评分

项目介绍:

SwiftyStarRatingView
https://github.com/Jerrrr/SwiftyStarRatingView

A simple star rating view written in pure swift, lightweight but powerful.

SwiftyStarRatingView 是一个用 swift 3.0 编写的评分控件,可以支持自定义图片和颜色,并且可以支持在XIB、StoreBoard中使用,并支持AutoLayout。

中文介绍

Screenshots



Requirements

  • iOS 8.0+

  • Xcode 8

  • Swift 3.0

CocoaPods

CocoaPods is the recommended way to add SwiftyStarRatingView to your project.

Add a pod entry for SwiftyStarRatingView to your Podfile.

    pod 'SwiftyStarRatingView'

Second, install SwiftyStarRatingView into your project:

    pod install

Manually

  1. Download the latest code version .

  2. Open your project in Xcode,drag the SwiftyStarRatingView folder into your project. Make sure to select Copy items when asked if you extracted the code archive outside of your project.

Usage

Create a simple rating view:

    let starRatingView = SwiftyStarRatingView()
    
    starRatingView.frame = CGRect(x: x, y: y, width: width, height: height)
    
    starRatingView.maximumValue = 5         //default is 5
    starRatingView.minimumValue = 0         //default is 0
    starRatingView.value = 3                //default is 0
    
    starRatingView.tintColor = UIColor.yellow
    
    starRatingView.addTarget(self, action: #selector(function), for: .valueChanged)
    
    self.view.addSubview(starRatingView)

Setting this property to control whether to display a half stars:

    starRatingView.allowsHalfStars = true     //default is true
    starRatingView.value = 3.5                //default is 0

Whether accurate display:

    starRatingView.accurateHalfStars = true //default is true

Always callback or just stop touch:

    starRatingView.continuous = true        //default is true

Use custom image:

    starRatingView.halfStarImage = UIImage(named: "half.png")
    starRatingView.emptyStarImage = UIImage(named: "empty.png")
    starRatingView.filledStarImage = UIImage(named: "filled.png")

StoryBoard or XIB:

SwiftyStarRatingView also works great with Auto Layout, you can use it in StoryBoard or XIB.

Contacts

If you wish to contact me, email at: chen.developer@foxmail.com

Sina : @后知后觉乀

code4app

相关源码推荐:

我来说两句
*滑动验证:
所有评论(5)
phoiu 2016-12-23 10:09:45
感谢分享,楼主V5~
回复
kengsir 2016-12-23 10:10:32
感谢分享,code4app有你更精彩
回复
BlueManlove 2016-12-23 10:11:08
code4app好的内容真的很多~赞
回复
littleRed 2016-12-23 10:12:52
膜拜大神~
回复
hellokenken 2016-12-23 10:14:59
膜拜大神~
回复
AlonMessi 2016-12-23 10:22:52
感谢大神~
回复
chaijingxue 2016-12-23 11:10:59
学习学习!
回复
code4app热心网友 2016-12-23 11:18:56
淡定,淡定,淡定……
回复
code4app热心网友 2016-12-23 11:19:07
楼主威武啊,Code4App有你更给力!
回复
提取码:  下载次数:11 状态:已购或VIP 售价:0(原价:10)金钱 下载权限:初级码农 
775 0 11
联系我们
首页/微信公众账号投稿

帖子代码编辑/版权问题

QQ:435399051,742864542

如何获得代码达人称号?

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

广告投放| Github|申请友链|手机版|Code4App ( 粤ICP备15117877号-1 )

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