Code Monkey home page Code Monkey logo

dlstarrating's Introduction

DLStarRating

A UIControl subclass that behaves similarly as the App Store rating control.

Written by David Linsin, January 2011.

Usage

You find all the sources include two sample images under DLStarRating. Add the source folder to your project and use the DLStarRatingControl in Interface Builder to setup a default 5 star rating control.

If you'd like to instantiate it yourself with a custom number of stars use:

// setup a control with 3 fractional stars at a size of 320x230
DLStarRatingControl *ratingControl = [[DLStarRatingControl alloc] initWithFrame:CGRectMake(0, 0, 320, 230) andStars:3 isFractional:YES];

You can set a default value by setting ratingControl.rating=2.5 and hook up a DLStarRatingDelegate to get notified when the user has changed the rating. Note: if you want to use fractional stars, you have to provide images with width divisible by 10.

To customize the stars, simply replace star.png/[email protected] and star_highlighted.png/[email protected] under images.

DLStarView.h lets you customize the area below the stars, detecting touches. Simply change the value of kEdgeInsetBottom to increase the area or make it smaller, in case you have other user interface components below. The default is 20px, which allows to select/deselect the stars, while still being able to see them above your finger.

DLStarRating should work with iOS 3.0+, but it has not been tested yet.

Demo

You can open the DLStarRating demo project in XCode and run it on your iPhone as well as in the Simulator. There's a DLStarRatingControl hooked up in DLStarRatingDemo.xib, as well as in DLStarRatingDemoViewController. It also shows how to set a rating value and use DLStarRatingDelegate.

Issues and Feature Requests

Please report issues via GitHub's issue tracker.

ARC

There's an ARC branch which you can use if your App uses the latest&greatest. It'll sooner or later find it's way into master.

UI Testing

The folder features contains the testing setup needed to run UI tests with zucchini.

License

DLStarRating is licensed under the Eclipse Public License.

dlstarrating's People

Contributors

dlinsin avatar martinjuhasz avatar tvon avatar kuchmiyalex avatar

Watchers

James Cloos avatar Samuele Mazza 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.