Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

JacquesSebrio/AMRatingControl

Open more actions menu
 
 

Repository files navigation

AMRatingControl

This is a fork from jasarien/JSFavStarControl.

AMRatingControl is a UI control that resembles the 'star rating' control seen in the iPod app.

AMRatingControl allows you to select a rating starting from 0 to any number of stars you want.

You can use default star symbols and customize colors or specify custom images.

How To Get Started

- Using CocoaPods

pod 'AMRatingControl'

- Without CocoaPods

Add AMRatingControl.h and AMRatingControl.m to your project.

Example Usage

#include "AMRatingControl.h"

// Create a simple instance, initing with :
// - a CGPoint (the position in your view from which it will be drawn)
// - and max rating
AMRatingControl *simpleRatingControl = [[AMRatingControl alloc] initWithLocation:(CGPoint)location
                                                         			andMaxRating:(NSInteger)maxRating];

// Customize the current rating if needed
[ratingControl setRating:(NSInteger)rating];

// Listen to control events
[simpleRatingControl addTarget:self action:@selector(updateRating:) forControlEvents:UIControlEventEditingChanged];
[simpleRatingControl addTarget:self action:@selector(updateEndRating:) forControlEvents:UIControlEventEditingDidEnd];

// Create an instance with images, initing with :
// - a CGPoint (the position in your view from which it will be drawn)
// - a custom empty image and solid image if you wish (pass nil if you want to use the default).
// - and max rating
AMRatingControl *imagesRatingControl = [[AMRatingControl alloc] initWithLocation:(CGPoint)location
                                          			                  emptyImage:(UIImage *)emptyImageOrNil
                                                     			      solidImage:(UIImage *)solidImageOrNil
	                                                                andMaxRating:(NSInteger)maxRating];

// Create an instance with custom colors, initing with :
// - a CGPoint (the position in your view from which it will be drawn)
// - a custom empty image and solid image if you wish (pass nil if you want to use the default).
// - and max rating
AMRatingControl *coloredRatingControl = [[AMRatingControl alloc] initWithLocation:(CGPoint)location
                                                                       emptyColor:(UIColor *)emptyColorOrNi
                                                                       solidColor:(UIColor *)solidColorOrNi
                                                                     andMaxRating:(NSInteger)maxRating];  

// Add the control(s) as subview of your view
[view addSubview:simpleRatingControl];
[view addSubview:imagesRatingControl];
[view addSubview:coloredRatingControl];

Example ScreenShot

ARC

AMRatingControl uses ARC.

License

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

About

A simple rating control for the iPhone

Resources

License

Stars

Watchers

Forks

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.