Skip to content

almassapargali/HCSStarRatingView

 
 

Repository files navigation

HCSStarRatingView

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 94.8%
  • Ruby 5.2%