Giter Club home page Giter Club logo

ttgemojirate's Introduction

TTGEmojiRate

An emoji-liked rating view for iOS, implemented in Swift3.

Android version: PeterSmileRate by SilicorniO. Great work ! :)

Build Status Version License Platform Swift3

Apps Using Total Download

Screenshot

Inspired by Rating Version A - Hoang Nguyen

Rating Version A - Hoang Nguyen

Blog
土土哥的技术Blog - Swift开源项目: TTGEmojiRate的实现

Features

  • More interactive with Emoji and drag gesture.
  • Highly customizable.
  • Can be used in Interface Builder.

IB example

What

TTGEmojiRate is an emoji-liked rating view for iOS which is implemented in Swift.
You can drop up and down on the Emoji face to change the rate, which is more interactive.
TTGEmojiRate is also highly customizable that many features of it can be configure, like the emoji line width and the mouth width.

Usage

Use TTGEmojiRate

  1. Create an instance of EmojiRateView and add it to the parent view.
let rateView = EmojiRateView.init(frame: CGRectMake(0, 0, 200, 200))
rateView.center = self.view.center
self.view.addSubview(rateView)
  1. Drop a view in the Interface builder and set the Custom Class to EmojiRateView

Run example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Swift3.
Xcode8.
iOS 8 and later.

Installation

CocoaPods

You can use CocoaPods to install TTGEmojiRate by adding it to your Podfile:

pod "TTGEmojiRate"

Carthage

You can use Carthage to install TTGEmojiRate by adding it to your Cartfile:

github "zekunyan/TTGEmojiRate"

Customization

Customization

rateValueChangeCallback

rateValueChangeCallback: ((newRateValue: Float) -> Void)? defines the callback closure when rateValue changes.

emojiRateView.rateValueChangeCallback = {(rateValue: Float) -> Void in
    NSLog("The new rate value is: \(rateValue)")
}

rateColorRange

rateColorRange: (from: UIColor, to: UIColor)
When rateValue changes from 0 to 5, the rateColor will change from the from: UIColor to to: UIColor.

emojiRateView.rateColorRange = (
    UIColor.redColor(), 
    UIColor.greenColor()
)

rateDragSensitivity

rateDragSensitivity: CGFloat defines the sensitivity when drag to change rateValue.

Author

zekunyan, [email protected]

License

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

ttgemojirate's People

Contributors

zekunyan avatar crspybits avatar moray95 avatar readmecritic avatar

Watchers

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