Giter Site home page Giter Site logo

jakouk / mgstarratingview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from magi82/mgstarratingview

0.0 2.0 0.0 1.19 MB

MGStarRatingView is a view for rating.

Home Page: https://magi82.github.io

License: MIT License

Ruby 4.36% Objective-C 4.42% Swift 91.22%

mgstarratingview's Introduction

MGStarRatingView

Swift Platform Version Carthage compatible CI Status License

MGStarRatingView is a view for rating.
Simple and easy to implement. โ˜€๏ธ

It supports programmatically and xib.
No image is required. Just choose color.

Sample

Usage (Programmatically)

  • Creating and Implementing a View
let starView = StarRatingView()
let attribute = StarRatingAttribute(type: .rate,
      point: 30,
      spacing: 10,
      emptyColor: .red,
      fillColor: .blue)
starView.configure(attribute, current: 0, max: 5)
starView.delegate = self
self.view.addSubview(starView)
  • Delegate implementation
func StarRatingValueChanged(view: StarRatingView, value: CGFloat) {
  // use value
}

Usage (xib)

First, add UIView.
Register Custom Class as StarRatingView and register Module as MGStarRatingView.

Please be careful.
If you type the spelling of Type String wrongly, it will be applied as the default type.
The default type is rate.

API Reference

// A delegate for receiving values.
public weak var delegate: StarRatingDelegate?

// A type that represents a value.
// There are three kinds. (rate, half, fill)
public var type: StarRatingType

// The current value.
public var current: CGFloat

// The maximum number of stars.
public var max: Int

// The spacing between stars.
public var spacing: CGFloat

// The size of the star.
// The horizontal and vertical sizes are the same.
public var point: CGFloat

// The color value of the empty star.
public var emptyColor: UIColor

// The color value of the full star.
public var fillColor: UIColor

Aid

Requirements

  • Swift 3.0+
  • Xcode 8.0+
  • iOS 8.0+

Installation

pod 'MGStarRatingView', '~> 0.2.0'
github "magi82/MGStarRatingView" ~> 0.2.0

Author

magi82, [email protected]

License

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

mgstarratingview's People

Contributors

magi82 avatar tiny2n avatar

Watchers

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