Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kronik/ScalePicker
Generic scale and a handy float-value picker for any iOS app.
https://github.com/kronik/ScalePicker
Last synced: about 1 month ago
JSON representation
Generic scale and a handy float-value picker for any iOS app.
- Host: GitHub
- URL: https://github.com/kronik/ScalePicker
- Owner: kronik
- License: mit
- Created: 2016-03-14T06:37:45.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-10T07:42:50.000Z (almost 8 years ago)
- Last Synced: 2024-10-28T12:55:14.212Z (about 2 months ago)
- Language: Objective-C
- Homepage: https://github.com/kronik/ScalePicker
- Size: 15.5 MB
- Stars: 167
- Watchers: 6
- Forks: 25
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - ScalePicker - Generic scale and a handy float-value picker for any iOS app. (etc)
- awesome - ScalePicker - Generic scale and a handy float-value picker for any iOS app. (etc)
README
# ScalePicker
Generic scale and a handy float-value picker for any iOS app.
## Preview
## Installation
### With source code
[Download repository](https://github.com/kronik/ScalePicker/archive/master.zip), then add [ScalePicker directory](https://github.com/kronik/ScalePicker/blob/master/ScalePicker/) to your project.
### With CocoaPods
CocoaPods is a dependency manager for Objective-C/Swift, which automates and simplifies the process of using 3rd-party libraries in your projects. To install with cocoaPods, follow the "Get Started" section on [CocoaPods](https://cocoapods.org/).
#### Podfile
```ruby
platform :ios, '8.0'
use_frameworks!pod 'ScalePicker'
```### With Carthage
Carthage is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods. To install with carthage, follow the instruction on [Carthage](https://github.com/Carthage/Carthage/).
You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
```bash
$ brew update
$ brew install carthage
```
To integrate ScalePicker into your Xcode project using Carthage, specify it in your `Cartfile`:```ogdl
github "kronik/ScalePicker"
```## Usage
### Initialisation
Instantiate scale view with preferred frame:
```swift
let screenWidth = UIScreen.mainScreen().bounds.size.width
let scaleView = ScalePicker(frame: CGRectMake(0, 0, screenWidth, 50))view.addSubview(scaleView)
```### Properties
####Set minimum value
```swift
scaleView.minValue = -3.0
```####Set maximum value
```swift
scaleView.maxValue = 3.0
```####Set number of ticks between values value
```swift
scaleView.numberOfTicksBetweenValues = 2
```####Set space between ticks
```swift
scaleView.spaceBetweenTicks = 20.0
```####Set tick label visibility
```swift
scaleView.showTickLabels = true
```####Set a delegate
```swift
scaleView.delegate = self
```####Set ability to snap to the nearest value
```swift
scaleView.snapEnabled = true
```####Set bounces value
```swift
scaleView.bounces = false
```####Set tick (and center/arrow view) color
```swift
scaleView.tickColor = UIColor.whiteColor()
```####Set center/arrow image
```swift
scaleView.centerArrowImage = UIImage(named: "arrowPointer")
```### Control actions
#### Increase current value```swift
scaleView.increaseValue()
```
#### Decrease current value```swift
scaleView.decreaseValue()
```
#### Reset current value```swift
scaleView.reset()
```
#### Gestures
In addition to increase/decrease/reset actions ScaleView allows you to double tap to trigger reset action### More
For more details try Xcode [Demo project](https://github.com/kronik/ScalePicker/blob/master/Demo)
# Etc.
* Contributions are very welcome.
* Attribution is appreciated (let's spread the word!), but not mandatory.## Use it? Love/hate it?
Tweet the author [@dklimkin](http://twitter.com/dklimkin), and check out Dmitry's portfolio: http://dmitry-klimkin.com
## License
ScalePicker is released under the MIT license. See [LICENSE](https://raw.githubusercontent.com/kronik/ScalePicker/master/LICENSE) for details.