iOS第三方星级视图控件——HCSStarRatingView
HCStarRatingView是一款十分小巧的星级视图控件,其通过原生画图的方式来渲染星级视图页面,同时,其也支持开发者对星级图片的自定义操作。
HCStarRatingView的git地址如下:[https://github.com/hsousa/HCSStarRatingView](https://github.com/hsousa/HCSStarRatingView)。
HCStarRatingView的使用十分简单,示例如下:
1 2 3 4
| HCSStarRatingView * starView = [[HCSStarRatingView alloc]initWithFrame:CGRectMake(20, 100, 280, 50)]; starView.tintColor = [UIColor redColor]; [starView addTarget:self action:@selector(didChange:) forControlEvents:UIControlEventValueChanged]; [self.view addSubview:starView];
|
效果如下图:
开发者也对其进行一些自定义的设置,列举如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| @property (nonatomic) IBInspectable NSUInteger maximumValue;
@property (nonatomic) IBInspectable CGFloat minimumValue;
@property (nonatomic) IBInspectable CGFloat value;
@property (nonatomic) IBInspectable CGFloat spacing;
@property (nonatomic) IBInspectable BOOL allowsHalfStars;
@property (nonatomic) IBInspectable BOOL accurateHalfStars;
@property (nonatomic) IBInspectable BOOL continuous;
@property (nonatomic) BOOL shouldBecomeFirstResponder;
@property (nonatomic, copy) HCSStarRatingViewShouldBeginGestureRecognizerBlock shouldBeginGestureRecognizerBlock;
@property (nonatomic, strong) IBInspectable UIImage *emptyStarImage;
@property (nonatomic, strong) IBInspectable UIImage *halfStarImage;
@property (nonatomic, strong) IBInspectable UIImage *filledStarImage;
|
专注技术,热爱生活,交流技术,也做朋友。
——珲少 QQ群:203317592