GithubHelp home page GithubHelp logo

lixar / amratingcontrol Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amseddi/amratingcontrol

0.0 8.0 0.0 975 KB

A simple rating control for the iPhone

License: MIT License

Ruby 4.64% Objective-C 79.35% HTML 16.01%

amratingcontrol's Introduction

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];

// Define block to handle events
simpleRatingControl.editingChangedBlock = ^(NSUInteger rating)
{
    [label setText:[NSString stringWithFormat:@"%d", rating]];
};
    
simpleRatingControl.editingDidEndBlock = ^(NSUInteger rating)
{
    [endLabel setText:[NSString stringWithFormat:@"%d", rating]];
};

// 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.

amratingcontrol's People

Contributors

amseddi avatar sguillope avatar jilouc avatar

Watchers

James Cloos avatar  avatar  avatar  avatar Bruce Rick avatar Noah McCann avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.