一個基于emoji的投票iOS視圖:TTGEmojiRate
一個基于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)") }
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!