SandorUK / HCSStarRatingView

Simple star rating view for iOS written in Objective-C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HCSStarRatingView

What the fork?

I've forked this because I needed to replace modular @import directive with #import just because I'm so into retro stuff.

What is this?

HCSStarRatingView is a UIControl subclass to easily provide users with a basic star-rating interface.

It supports all device resolutions and requires no images do render the stars, thanks to PaintCode.

Installation

Via CocoaPods, add this line to your Podfile

pod 'HCSStarRatingView', :git => 'https://github.com/hugocampossousa/HCSStarRatingView.git'

and run pod install

You can also install it manually by copying HCSStarRatingView.h and HCSStarRatingView.m into your project.

Usage

Programatically

You can create a new rating view programatically by importing HCSStarRatingView.h and HCSStarRatingView.m into your project and:

#import "HCSStarRatingView.h"
HCSStarRatingView *starRatingView = [[HCSStarRatingView alloc] initWithFrame:CGRectMake(50, 200, 200, 50)];
starRatingView.maximumValue = 10;
starRatingView.minimumValue = 0;
starRatingView.value = 0;
starRatingView.tintColor = [UIColor redColor];
[starRatingView addTarget:self action:@selector(didChangeValue:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:starRatingView];

It also supports half-star ratings:

starRatingView.allowsHalfStars = YES;
starRatingView.value = 2.5f;

Interface Builder

HCSStarRatingView also implements IB_DESIGNABLE and IBInspectable so you can fully customize it in Interface Builder.

Contact

Hugo Sousa

License

HCSStarRatingView is available under the MIT license. See the LICENSE file for more info.

About

Simple star rating view for iOS written in Objective-C

License:MIT License


Languages

Language:Objective-C 87.3%Language:Ruby 12.7%