10 Commits

Author SHA1 Message Date
Hamza Ghazouani 91b68355a2 Update HGCircularSlider.podspec 2016-11-10 22:27:02 +01:00
Hamza Ghazouani 60624ed8d7 Update .swift-version 2016-11-10 22:26:09 +01:00
Hamza GHAZOUANI 22510b664a Make the method init(frame) public 2016-11-10 22:19:01 +01:00
Hamza Ghazouani e68b7d1aa4 Create .jazzy.yaml 2016-11-10 22:02:45 +01:00
Hamza Ghazouani eef7869d31 Update README.md 2016-11-10 01:35:22 +01:00
Hamza Ghazouani 81def37876 Update README.md 2016-11-10 01:33:03 +01:00
Hamza Ghazouani c481adaf0b Update README.md 2016-11-10 01:30:40 +01:00
Hamza Ghazouani a649a9fd15 Update README.md 2016-11-10 00:57:11 +01:00
Hamza GHAZOUANI 2a7e0f372b Update GIF size 2016-11-10 00:53:56 +01:00
Hamza GHAZOUANI 02b7296466 Add GIFs 2016-11-10 00:38:44 +01:00
12 changed files with 85 additions and 58 deletions
+1
View File
@@ -0,0 +1 @@
jazzy --podspec HGCircularSlider.podspec
+1 -1
View File
@@ -1 +1 @@
2.3
2.2
+1 -1
View File
@@ -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)
}
}
+40 -1
View File
@@ -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
+40 -3
View File
@@ -4,22 +4,59 @@
[![CI Status](http://img.shields.io/travis/HamzaGhazouani/HGCircularSlider.svg?style=flat)](https://travis-ci.org/Hamza Ghazouani/HGCircularSlider)
[![Version](https://img.shields.io/cocoapods/v/HGCircularSlider.svg?style=flat)](http://cocoapods.org/pods/HGCircularSlider)
[![License](https://img.shields.io/cocoapods/l/HGCircularSlider.svg?style=flat)](http://cocoapods.org/pods/HGCircularSlider)
[![Platform](https://img.shields.io/cocoapods/p/HGCircularSlider.svg?style=flat)](http://cocoapods.org/pods/HGCircularSlider)
[![Platform](https://img.shields.io/cocoapods/p/HGCircularSlider.svg?style=flat)](http://cocoapods.org/pods/HGCircularSlider) <br />
[![Readme Score](http://readme-score-api.herokuapp.com/score.svg?url=https://github.com/hamzaghazouani/hgcircularslider/)](http://clayallsopp.github.io/readme-score?url=https://github.com/hamzaghazouani/hgcircularslider/tree/develop)
[![codebeat badge](https://codebeat.co/badges/c4db03f5-903a-4b0e-84bb-98362fc5bd7a)](https://codebeat.co/projects/github-com-hamzaghazouani-hgcircularslider)
## Example
![](/Screenshots/Clock.gif) ![](/Screenshots/Player.gif) ![](/Screenshots/OClock.gif) ![](/Screenshots/BasicExample.gif)
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