4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | # ScalePicker
12 |
13 | Generic scale and a handy float-value picker for any iOS app.
14 |
15 | ## Preview
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | ## Installation
25 |
26 | ### With source code
27 |
28 | [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.
29 |
30 | ### With CocoaPods
31 |
32 | 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/).
33 |
34 | #### Podfile
35 | ```ruby
36 | platform :ios, '8.0'
37 | use_frameworks!
38 |
39 | pod 'ScalePicker'
40 | ```
41 |
42 | ### With Carthage
43 |
44 | 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/).
45 |
46 | You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
47 |
48 | ```bash
49 | $ brew update
50 | $ brew install carthage
51 | ```
52 | To integrate ScalePicker into your Xcode project using Carthage, specify it in your `Cartfile`:
53 |
54 | ```ogdl
55 | github "kronik/ScalePicker"
56 | ```
57 |
58 | ## Usage
59 |
60 | ### Initialisation
61 |
62 | Instantiate scale view with preferred frame:
63 |
64 | ```swift
65 | let screenWidth = UIScreen.mainScreen().bounds.size.width
66 | let scaleView = ScalePicker(frame: CGRectMake(0, 0, screenWidth, 50))
67 |
68 | view.addSubview(scaleView)
69 | ```
70 |
71 | ### Properties
72 |
73 | ####Set minimum value
74 |
75 | ```swift
76 | scaleView.minValue = -3.0
77 | ```
78 |
79 | ####Set maximum value
80 |
81 | ```swift
82 | scaleView.maxValue = 3.0
83 | ```
84 |
85 | ####Set number of ticks between values value
86 |
87 | ```swift
88 | scaleView.numberOfTicksBetweenValues = 2
89 | ```
90 |
91 | ####Set space between ticks
92 |
93 | ```swift
94 | scaleView.spaceBetweenTicks = 20.0
95 | ```
96 |
97 | ####Set tick label visibility
98 |
99 | ```swift
100 | scaleView.showTickLabels = true
101 | ```
102 |
103 | ####Set a delegate
104 |
105 | ```swift
106 | scaleView.delegate = self
107 | ```
108 |
109 | ####Set ability to snap to the nearest value
110 |
111 | ```swift
112 | scaleView.snapEnabled = true
113 | ```
114 |
115 | ####Set bounces value
116 |
117 | ```swift
118 | scaleView.bounces = false
119 | ```
120 |
121 | ####Set tick (and center/arrow view) color
122 |
123 | ```swift
124 | scaleView.tickColor = UIColor.whiteColor()
125 | ```
126 |
127 | ####Set center/arrow image
128 |
129 | ```swift
130 | scaleView.centerArrowImage = UIImage(named: "arrowPointer")
131 | ```
132 |
133 | ### Control actions
134 | #### Increase current value
135 |
136 | ```swift
137 | scaleView.increaseValue()
138 | ```
139 | #### Decrease current value
140 |
141 | ```swift
142 | scaleView.decreaseValue()
143 | ```
144 | #### Reset current value
145 |
146 | ```swift
147 | scaleView.reset()
148 | ```
149 | #### Gestures
150 | In addition to increase/decrease/reset actions ScaleView allows you to double tap to trigger reset action
151 |
152 | ### More
153 |
154 | For more details try Xcode [Demo project](https://github.com/kronik/ScalePicker/blob/master/Demo)
155 |
156 | # Etc.
157 |
158 | * Contributions are very welcome.
159 | * Attribution is appreciated (let's spread the word!), but not mandatory.
160 |
161 | ## Use it? Love/hate it?
162 |
163 | Tweet the author [@dklimkin](http://twitter.com/dklimkin), and check out Dmitry's portfolio: http://dmitry-klimkin.com
164 |
165 | ## License
166 |
167 | ScalePicker is released under the MIT license. See [LICENSE](https://raw.githubusercontent.com/kronik/ScalePicker/master/LICENSE) for details.
168 |
--------------------------------------------------------------------------------
/ScalePicker.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 |
3 | s.name = 'ScalePicker'
4 | s.version = '2.7.11'
5 | s.platform = :ios, '8.0'
6 | s.license = 'MIT'
7 | s.homepage = 'https://github.com/kronik/ScalePicker'
8 | s.author = { 'Dmitry Klimkin' => 'dmitry.klimkin@gmail.com' }
9 | s.source = { :git => 'https://github.com/kronik/ScalePicker.git', :tag => s.version }
10 | s.summary = 'Generic scale and a float value picker for any iOS app'
11 | s.ios.deployment_target = '8.0'
12 | s.framework = 'UIKit'
13 | s.requires_arc = true
14 |
15 | s.source_files = 'ScalePicker/*.swift'
16 |
17 | end
18 |
--------------------------------------------------------------------------------
/ScalePicker.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ScalePicker.xcodeproj/xcshareddata/xcschemes/ScalePicker.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
45 |
46 |
52 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
70 |
71 |
72 |
73 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/ScalePicker/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ScalePicker/ScalePicker.h:
--------------------------------------------------------------------------------
1 | //
2 | // ScalePicker.h
3 | // ScalePicker
4 | //
5 | // Created by Dmitry on 15/3/16.
6 | // Copyright © 2016 Dmitry Klimkin. All rights reserved.
7 | //
8 |
9 | @import Foundation;
10 |
11 | //! Project version number for ScalePicker.
12 | FOUNDATION_EXPORT double ScalePickerVersionNumber;
13 |
14 | //! Project version string for ScalePicker.
15 | FOUNDATION_EXPORT const unsigned char ScalePickerVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 |
19 |
20 |
--------------------------------------------------------------------------------
/ScalePicker/SlidePickerFlowLayout.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SlidePickerFlowLayout.swift
3 | // Dmitry Klimkin
4 | //
5 | // Created by Dmitry Klimkin on 15/3/16.
6 | // Copyright © 2016 Dmitry Klimkin. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import UIKit
11 |
12 | public class SlidePickerFlowLayout: UICollectionViewFlowLayout {
13 |
14 | }
--------------------------------------------------------------------------------
/Screenshots/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kronik/ScalePicker/5e59efe4a8d1421c3e80c1cd5fe12c9635662d70/Screenshots/1.jpg
--------------------------------------------------------------------------------
/Screenshots/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kronik/ScalePicker/5e59efe4a8d1421c3e80c1cd5fe12c9635662d70/Screenshots/1.png
--------------------------------------------------------------------------------
/Screenshots/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kronik/ScalePicker/5e59efe4a8d1421c3e80c1cd5fe12c9635662d70/Screenshots/2.png
--------------------------------------------------------------------------------
/Screenshots/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kronik/ScalePicker/5e59efe4a8d1421c3e80c1cd5fe12c9635662d70/Screenshots/3.png
--------------------------------------------------------------------------------
/Screenshots/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kronik/ScalePicker/5e59efe4a8d1421c3e80c1cd5fe12c9635662d70/Screenshots/demo.gif
--------------------------------------------------------------------------------