-
进行评分(支持点击,滑动,最少星星数设置)
-
展示评分
-
类型选择(整颗星,半颗星,部分星星)
- Swift 5.0
- iOS 9.0.0+
- Xcode 10.2
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
To integrate StarRate into your Xcode project using Carthage, specify it in your Cartfile
:
github "chenjie1219/StarRate"
Run carthage update
to build the framework and drag the built StarRateView.framework
into your Xcode project.
Just download the project, and drag and drop the "StarRateView" folder in your project.
/// 创建视图对象(totalStarCount:总星星数量, currentStarCount:当前星星数, starSpace:星星的间隔)
let starView = StarRateView(frame: CGRect(x: 0, y: 0, width: 120, height: 20),totalStarCount: 5 ,currentStarCount: 0 ,starSpace: 5)
/// 显示星级视图(type:星星类型, isPanEnable:是否可滑动评分, leastStar:评分的最少星星数)
starView.show(type: .default, isPanEnable: true, leastStar: 0) { (score) in
/// 评分后的回调方法
<#code#>
}
/// 创建视图对象(totalStarCount:总星星数量, currentStarCount:当前星星数, starSpace:星星的间隔)
let starView = StarRateView(frame: CGRect(x: 0, y: 0, width: 120, height: 20),totalStarCount: 5 ,currentStarCount: 3 ,starSpace: 5)
/// 关闭用户手势操作,默认是开启的(关闭后不可点击,不可滑动,仅用来显示当前评分)
starView.isUserInteractionEnabled = false//不支持用户手势操作
-
Email:4234115@qq.com
-
Wechat:4234115