Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Jerrrr/SwiftyStarRatingView
https://github.com/Jerrrr/SwiftyStarRatingView
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/Jerrrr/SwiftyStarRatingView
- Owner: Jerrrr
- License: gpl-3.0
- Created: 2016-12-07T02:46:35.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-08-22T03:40:12.000Z (over 5 years ago)
- Last Synced: 2024-09-19T10:02:29.587Z (4 months ago)
- Language: Swift
- Homepage:
- Size: 1.28 MB
- Stars: 137
- Watchers: 5
- Forks: 32
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - SwiftyStarRatingView - A simple star rating view written in pure swift, lightweight but powerful. (OOM-Leaks-Crash / Star View)
README
#### A simple star rating view written in pure swift, lightweight but powerful.
###### [π¨π³δΈζδ»η»](http://www.jianshu.com/p/28d5f0bac8fd)
## Screenshots
## Requirements
- iOS 8.0+
- Xcode 9
- Swift 4.0## CocoaPods
CocoaPods is the recommended way to add SwiftyStarRatingView to your project.
Add a pod entry for SwiftyStarRatingView to your Podfile.
```
pod 'SwiftyStarRatingView'
```
Second, install SwiftyStarRatingView into your project:
```
pod install
```## Carthage
If you prefer to install SwiftyStarRatingView via Carthage include the following line in your Cartfile:
```
github "jerrrr/SwiftyStarRatingView"
```## Manually
1. Download the latest code version .
2. Open your project in Xcode,drag the `SwiftyStarRatingView` folder into your project. Make sure to select Copy items when asked if you extracted the code archive outside of your project.## Usage
#### Create a simple rating viewοΌ
```
let starRatingView = SwiftyStarRatingView()
starRatingView.frame = CGRect(x: x, y: y, width: width, height: height)
starRatingView.maximumValue = 5 //default is 5
starRatingView.minimumValue = 0 //default is 0
starRatingView.value = 3 //default is 0
starRatingView.tintColor = UIColor.yellow
starRatingView.addTarget(self, action: #selector(function), for: .valueChanged)
self.view.addSubview(starRatingView)
```#### Setting this property to control whether to display a half stars:
```
starRatingView.allowsHalfStars = true //default is true
starRatingView.value = 3.5 //default is 0
```#### Whether accurate display:
```
starRatingView.accurateHalfStars = true //default is true
```#### Always callback or just stop touch:
```
starRatingView.continuous = true //default is true
```#### Use custom image:
```
starRatingView.halfStarImage = UIImage(named: "half.png")
starRatingView.emptyStarImage = UIImage(named: "empty.png")
starRatingView.filledStarImage = UIImage(named: "filled.png")
```#### StoryBoard or XIB:
`SwiftyStarRatingView` also works great with Auto Layout, you can use it in StoryBoard or XIB.
## Contacts
#### If you wish to contact me, email at: [email protected]
##### Sina : [@εη₯εθ§δΉ](http://weibo.com/2538296781)
## License
SwiftyStarRatingView is released under the [GNU GENERAL PUBLIC LICENSE](LICENSE). See LICENSE for details.