Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 70fa6d1acd |
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.5</string>
|
||||
<string>1.0.6</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -11,7 +11,11 @@ import JOCircularSlider
|
||||
|
||||
class ViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var circularSlider: CircularSlider!
|
||||
@IBOutlet weak var circularSlider: CircularSlider! {
|
||||
didSet {
|
||||
circularSlider.addTarget(self, action: #selector(handleValueChanged(_:)), for: .valueChanged)
|
||||
}
|
||||
}
|
||||
@IBOutlet weak var stackView: UIStackView!
|
||||
@IBOutlet weak var widthConstraint: NSLayoutConstraint! {
|
||||
didSet {
|
||||
@@ -117,6 +121,10 @@ class ViewController: UIViewController {
|
||||
circularSlider.maxidotOnColor = UIColor(hue: CGFloat(sender.value), saturation: 1, brightness: 1, alpha: 1)
|
||||
}
|
||||
|
||||
@IBAction func handleValueChanged(_ sender: CircularSlider) {
|
||||
print(sender.value)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.5</string>
|
||||
<string>1.0.6</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.5</string>
|
||||
<string>1.0.6</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.5</string>
|
||||
<string>1.0.6</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'JOCircularSlider'
|
||||
s.version = '1.0.5'
|
||||
s.version = '1.0.6'
|
||||
s.summary = 'A highly customisable and reusable iOS circular slider.'
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
|
||||
@@ -309,6 +309,8 @@ open class CircularSlider: UIControl {
|
||||
guard abs(angelDeltaAsPercentage) < 1 else { return }
|
||||
let newValue = isClockwise ? value + angelDeltaAsPercentage : value - angelDeltaAsPercentage
|
||||
setValue(newValue, isPercentage: true)
|
||||
|
||||
sendActions(for: .valueChanged)
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
@@ -38,9 +38,6 @@ pod 'JOCircularSlider'
|
||||
## Usage
|
||||
1. Visually:
|
||||
|
||||
```swift
|
||||
import JOCircularSlider
|
||||
```
|
||||
Drag a UIView to your storyboard, change its class of to CircularSlider and start visually customising the design to your liking.
|
||||
All the parameters are IBInspectable, so you can configure the slider straight from the attribute inspector tab, without having to write a single line of code.
|
||||
|
||||
@@ -68,6 +65,7 @@ The slider's `value` property is read-only.
|
||||
*/
|
||||
open private (set) var value: Float = 0
|
||||
```
|
||||
|
||||
To set the slider's value use the following:
|
||||
```swift
|
||||
/**
|
||||
@@ -78,6 +76,11 @@ To set the slider's value use the following:
|
||||
open func setValue(_ newValue: Float, isPercentage: Bool = false)
|
||||
```
|
||||
|
||||
In order to get value change notifications, use the `Target-Action` pattern which is an inherent part of UIControl, like so:
|
||||
``` swift
|
||||
circularSlider.addTarget(target: Any?, action: Selector, for: UIControl.valueChanged)
|
||||
```
|
||||
|
||||
To Control the text's appearance, use these:
|
||||
```swift
|
||||
open func setTextFont(named: String, textColor: UIColor, multiplier: CGFloat)
|
||||
|
||||
Reference in New Issue
Block a user