Giter VIP home page Giter VIP logo

dxstarratingview's Introduction

DXStarRatingView

DXStarRatingView

Simple and easy to use StarRatingView for iOS

Steps to use:

  1. Add DXStarRatingView.h,DXStarRatingView.m, rating-star-on.png and rating-star-off.png into your project.

  2. Just add an UIView in the ViewController or TableViewCell in which you want to use the star rating view. And specify the custom class in the inspector on right pane as DXStarRatingView. Image That Shows how add UIView and Change the custom class in inspector

  3. If you are NOT using auto layout then the DXStarRatingView can calculate its own frame size according to the rating-star-on.png image. But if you use auto-layout then you need to be careful about the frame of the rating view. Use this formula to find the correct frame size to assign it in XIB.

frame.size.width = (starImageOn.size.width*5)+(4*kStarPadding)

kStarPadding is a macro to define the gap between the stars. By default it is 1.0f px and it looks good. You are encouraged to configure it yourself to suit your need.

frame.size.height = starImageOn.size.height

Not much to say about height.

Create an IBOutlet for the view

@property (weak, nonatomic) IBOutlet DXStarRatingView *starRatingView;

In viewDidLoad or wherever you want to configure the star rating view, add the following code

[self.starRatingView setStars:4 callbackBlock:^(NSNumber *newRating) { NSLog(@"didChangeRating: %@",newRating); }];

License

MIT Licensed

http://opensource.org/licenses/MIT

dxstarratingview's People

Contributors

s3lvin avatar

Watchers

 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.