Score
0
Watch 3 Star 16 Fork 4

vjieshao / StarEvaluateViewSwift

Join us
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
Swift版本星级评价控件,支持半星评价和设置间隙 spread retract

Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

StarEvaluateView

Swift版本星级评价控件,支持半星评价和设置间隙

系统支持: iOS7+,iPhone/iPad, Swift2.3/3.0

使用效果

案例展示

如何使用StarEvaluateView

直接把StarEvaluateView.swift文件夹导入到工程中,即可使用。根目录包含一个swift2.3版本的SatrEvaluateView,如果你工程是用swift2.3编写的,可以导入那个。

用纯代码写StarEvaluateView

    let halfStarView = StarEvaluateView(sumCount: 5, starSpace: 20, norImg: UIImage(named: "GoodsDetailCollection"), selImg: UIImage(named: "yellowStar"))
    halfStarView.hasShowHalfStar = true // 是否打开半星
    halfStarView.frame = CGRect(x: 20, y: titleLabel.frame.maxY + 10, width: 205, height: 20)
    view.addSubview(halfStarView)

用xib/SB写StarEvaluateView

1、首先在xib创建一个view,如图所示:

StarEvaluateView

2、设置view继承自StarEvaluateView

StarEvaluateView

3、在xib中设置相关的属性

StarEvaluateView

公共属性

    // 星级数量
    var starCount: Int = 0
    // 空隙大小
    var space: CGFloat = 0
    // 正常时显示的图片
    var normalImg: UIImage?
    // 选中时显示的图片
    var selectedImg: UIImage?
    // 是否显示半星(默认不现实)
    var hasShowHalfStar = false
    // 星星数回调
    var successBlock: StarEvaluateViewSuccessBlock?

Comments ( 0 )

Sign in for post a comment

Swift
1
https://gitee.com/vjieshao/StarEvaluateView.git
git@gitee.com:vjieshao/StarEvaluateView.git
vjieshao
StarEvaluateView
StarEvaluateView
master

Help Search