Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 91b68355a2 | |||
| 60624ed8d7 | |||
| 22510b664a | |||
| e68b7d1aa4 | |||
| eef7869d31 | |||
| 81def37876 | |||
| c481adaf0b | |||
| a649a9fd15 | |||
| 2a7e0f372b | |||
| 02b7296466 |
@@ -0,0 +1 @@
|
||||
jazzy --podspec HGCircularSlider.podspec
|
||||
+1
-1
@@ -1 +1 @@
|
||||
2.3
|
||||
2.2
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'HGCircularSlider'
|
||||
s.version = '0.1.1'
|
||||
s.version = '0.1.2'
|
||||
s.summary = 'Multiple Circular Sliders used to select a value from a continuous range of values.'
|
||||
|
||||
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
//
|
||||
// CircularSlider+Touch.swift
|
||||
// Pods
|
||||
//
|
||||
// Created by Hamza Ghazouani on 26/10/2016.
|
||||
//
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
extension CircularSlider {
|
||||
|
||||
// MARK: user interaction methods
|
||||
|
||||
/**
|
||||
See superclass documentation
|
||||
*/
|
||||
override public func beginTrackingWithTouch(touch: UITouch, withEvent event: UIEvent?) -> Bool {
|
||||
sendActionsForControlEvents(.EditingDidBegin)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
See superclass documentation
|
||||
*/
|
||||
override public func continueTrackingWithTouch(touch: UITouch, withEvent event: UIEvent?) -> Bool {
|
||||
|
||||
// the position of the pan gesture
|
||||
let touchPosition = touch.locationInView(self)
|
||||
|
||||
let startPoint = CGPoint(x: bounds.center.x, y: 0)
|
||||
let angle = CircularSliderHelper.angle(betweenFirstPoint: startPoint, secondPoint: touchPosition, inCircleWithCenter: bounds.center)
|
||||
|
||||
let interval = Interval(min: minimumValue, max: maximumValue)
|
||||
let newValue = CircularSliderHelper.value(inInterval: interval, fromAngle: angle)
|
||||
|
||||
endPointValue = newValue
|
||||
sendActionsForControlEvents(.ValueChanged)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
See superclass documentation
|
||||
*/
|
||||
public override func endTrackingWithTouch(touch: UITouch?, withEvent event: UIEvent?) {
|
||||
sendActionsForControlEvents(.EditingDidEnd)
|
||||
}
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public class CircularSlider: UIControl {
|
||||
/**
|
||||
See superclass documentation
|
||||
*/
|
||||
override init(frame: CGRect) {
|
||||
override public init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
||||
setup()
|
||||
@@ -228,4 +228,43 @@ public class CircularSlider: UIControl {
|
||||
}
|
||||
drawThumb(withImage: image, angle: endAngle, inContext: context)
|
||||
}
|
||||
|
||||
// MARK: User interaction methods
|
||||
|
||||
/**
|
||||
See superclass documentation
|
||||
*/
|
||||
override public func beginTrackingWithTouch(touch: UITouch, withEvent event: UIEvent?) -> Bool {
|
||||
sendActionsForControlEvents(.EditingDidBegin)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
See superclass documentation
|
||||
*/
|
||||
override public func continueTrackingWithTouch(touch: UITouch, withEvent event: UIEvent?) -> Bool {
|
||||
|
||||
// the position of the pan gesture
|
||||
let touchPosition = touch.locationInView(self)
|
||||
|
||||
let startPoint = CGPoint(x: bounds.center.x, y: 0)
|
||||
let angle = CircularSliderHelper.angle(betweenFirstPoint: startPoint, secondPoint: touchPosition, inCircleWithCenter: bounds.center)
|
||||
|
||||
let interval = Interval(min: minimumValue, max: maximumValue)
|
||||
let newValue = CircularSliderHelper.value(inInterval: interval, fromAngle: angle)
|
||||
|
||||
endPointValue = newValue
|
||||
sendActionsForControlEvents(.ValueChanged)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
See superclass documentation
|
||||
*/
|
||||
public override func endTrackingWithTouch(touch: UITouch?, withEvent event: UIEvent?) {
|
||||
sendActionsForControlEvents(.EditingDidEnd)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public class MidPointCircularSlider: RangeCircularSlider {
|
||||
drawThumb(withImage: image, angle: midAngle, inContext: context)
|
||||
}
|
||||
|
||||
// MARK: user interaction
|
||||
// MARK: User interaction methods
|
||||
|
||||
/**
|
||||
See superclass documentation
|
||||
|
||||
@@ -245,7 +245,7 @@ public class RangeCircularSlider: CircularSlider {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: user interaction methods
|
||||
// MARK: User interaction methods
|
||||
|
||||
/**
|
||||
See superclass documentation
|
||||
|
||||
@@ -4,22 +4,59 @@
|
||||
[](https://travis-ci.org/Hamza Ghazouani/HGCircularSlider)
|
||||
[](http://cocoapods.org/pods/HGCircularSlider)
|
||||
[](http://cocoapods.org/pods/HGCircularSlider)
|
||||
[](http://cocoapods.org/pods/HGCircularSlider)
|
||||
[](http://cocoapods.org/pods/HGCircularSlider) <br />
|
||||
|
||||
[](http://clayallsopp.github.io/readme-score?url=https://github.com/hamzaghazouani/hgcircularslider/tree/develop)
|
||||
[](https://codebeat.co/projects/github-com-hamzaghazouani-hgcircularslider)
|
||||
|
||||
## Example
|
||||
|
||||
   
|
||||
|
||||
To run the example project, clone the repo, and run `pod install` from the Example directory first.
|
||||
|
||||
## Requirements
|
||||
|
||||
- iOS 7.1+
|
||||
- Xcode 7.3
|
||||
|
||||
## Installation
|
||||
|
||||
HGCircularSlider is available through [CocoaPods](http://cocoapods.org). To install
|
||||
it, simply add the following line to your Podfile:
|
||||
|
||||
```ruby
|
||||
pod "HGCircularSlider"
|
||||
``` ruby
|
||||
# Swift 2.2 - Xcode 7.3.1
|
||||
pod 'HGCircularSlider', '~> 0.1.1'
|
||||
```
|
||||
## Usage
|
||||
|
||||
1. Change the class of a view from UIView to CircularSlider, RangeCircularSlider or MidPointCircularSlider
|
||||
2. Programmatically:
|
||||
|
||||
```
|
||||
let circularSlider = CircularSlider(frame: myFrame)
|
||||
```
|
||||
OR
|
||||
```
|
||||
let circularSlider = RangeCircularSlider(frame: myFrame)
|
||||
```
|
||||
OR
|
||||
```
|
||||
let circularSlider = MidPointCircularSlider(frame: myFrame)
|
||||
```
|
||||
## Documentation
|
||||
You can install documentation locally using [jazzy](https://github.com/realm/jazzy).
|
||||
<!-- Full API documentation is available on [CocoaDocs](http://cocoadocs.org/docsets/HGCircularSlider/).<br/> -->
|
||||
|
||||
## References
|
||||
The UI examples of the demo project inspired from [Dribbble](https://github.com/realm/jazzy).
|
||||
|
||||
[Player](https://dribbble.com/shots/3062636-Countdown-Timer-Daily-UI-014)
|
||||
[BasicExample](https://dribbble.com/shots/2153963-Dompet-Wallet-App)
|
||||
[OClock](https://dribbble.com/shots/2671286-Clock-Alarm-app)
|
||||
|
||||
The project is Inspired from [UICircularSlider](https://github.com/Zedenem/UICircularSlider)
|
||||
|
||||
## Author
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 158 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 320 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 177 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 256 KiB |
Reference in New Issue
Block a user