一个基于emoji的投票iOS视图:TTGEmojiRate
jopen
9年前
一个基于emoji的投票iOS视图,采用Swift开发
Inspired by Rating Version A - Hoang Nguyen
Features
- More interactive with Emoji.
- Highly customizable.
- Can be used in Interface Builder.
What
TTGEmojiRate is an emoji-based 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
- 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)
- Drop a view in the Interface builder and set theCustom ClasstoEmojiRateView
Run example
To run the example project, clone the repo, and runpod installfrom the Example directory first.
Requirements
Swift.
iOS 8 and later.
Installation
TTGEmojiRate is available through CocoaPods. To install it, simply add the following line to your Podfile:
platform :ios, '8.0' use_frameworks! pod "TTGEmojiRate"
Customization
rateValueChangeCallback
rateValueChangeCallback: ((newRateValue: Float) -> Void)?defines the callback closure whenrateValuechanges.
emojiRateView.rateValueChangeCallback = {(rateValue: Float) -> Void in NSLog("The new rate value is: \(rateValue)") }