shushutochako / circleslider Goto Github PK
View Code? Open in Web Editor NEWCircleSlider is a Circular slider library. written in pure Swift.
License: MIT License
CircleSlider is a Circular slider library. written in pure Swift.
License: MIT License
I was using the circle slider for my app, when this happened:
private func redraw() {
self.trackLayer.removeFromSuperlayer()
self.trackLayer = TrackLayer(bounds: self.bounds, setting: self.createLayerSetting())
self.thumbView.removeFromSuperview()
self.thumbView = UIView(frame: CGRect(x: 0, y: 0, width: self.thumbWidth, height: self.thumbWidth))
self.layout(self.latestDegree)
}
It called a EXC Bad Instruction on the .removeFromSuperlayer()
. This is part of the framework.
When I run on a physical device, I get EXC_BREAKPOINT and my view won't load.
The cause may have been when I used
circleSlider.addTarget(self, action: #selector(TodayViewController.chngVol(_:)), forControlEvents: .ValueChanged)
without specifying it as an Optional, as Xcode wouldn't let me make it an Optional.
How should I fix this?!
Hi,
There is a little problem with the thumb.
If you set its width much larger than the bar width, you can touch it at its external bounds.
It is because it is outer the slider area.
(If you touch a control outer from its superview, it does not respond to touch)
I think you need to enlarge the slider area by 0.5 * thumb width.
Thanks !
Hi,
I wanted to try your pod, but I had following problems. I managed to overcome them (leave my solutions for reference), but it think it could be fixed for other users:
(I don't know if 3 and 4 are fixable, but let's hope so :) )
Also pod install throws some warnings and on IPhone 5C sliders overleap with progress circle (but it doesn't make it unreadable).
Thank you for this pod. I think it will really help me.
Does library work with new Xcode 8 update ?
Hi,
Sorry to bother again...
I would like to set a starting value to the slider. It should appeared on the beginning like that :
I did not find a correct way to do that. For now, I am setting in viewWillAppear :
circleSlider.value = 30
but it briefly shows zero value before displaying value as 30.
Do you have any idea ?
Thanks a lot !
Hi,
it is a really beautiful widget you have done !
How can I add a tap gesture on the circle, in addition to sliding move ?
Thanks !
Usually I use sender.value to get the current value but I can't do that with this library. Only UILabel can get the current value such as the example down there? But I want to use it as float and send it to another function, what can I do?
func valueChange(sender: CircleSlider) {
switch sender.tag {
case 0:
self.valueLabel.text = "(Int(sender.value))"
case 1:
self.progressLabel.text = "(Int(sender.value))%"
default:
break
}
}
How can I change min, max value (or other option values) dynamically?
If you set different values for height and width�, Circle is not drawn correctly
ex)
let rect = CGRect(x: 0, y: 0, width: 100, height: 200)
self.circleSlider = CircleSlider(frame: rect, options: nil)
hello
how can look FoodQSlider ?
@IBOutlet weak var FoodQSlider : UIView!
private func buildCircleSliderFoodQSlider() {
self.circleSlider = CircleSlider(frame: self.FoodQSlider.bounds, options: self.sliderOptions)
let delay = 0.1 * Double(NSEC_PER_SEC)
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
dispatch_after(time, dispatch_get_main_queue(), {
self.circleSlider.value = Float(self.reviwesRoundTwo[0])
})
self.FoodQSlider.addSubview(self.circleSlider!)
self.valueLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
self.valueLabel.textAlignment = .Center
self.valueLabel.center = CGPoint(x: CGRectGetWidth(self.circleSlider.bounds) * 0.5, y: CGRectGetHeight(self.circleSlider.bounds) * 0.5)
self.valueLabel.text = String(reviwesRoundTwo[0])
self.circleSlider.addSubview(self.valueLabel)
}
hello
I am used few to slider
@IBOutlet weak var FoodQSlider : UIView!
@IBOutlet weak var Cleanness : UIView!
@IBOutlet weak var StaffPerformance : UIView!
@IBOutlet weak var Facilities : UIView!
@IBOutlet weak var InternetService : UIView!
@IBOutlet weak var AccToBazzar : UIView!
@IBOutlet weak var AccToEntertain : UIView!
and The initialization all have
let delay = 0.1 * Double(NSEC_PER_SEC)
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
dispatch_after(time, dispatch_get_main_queue(), {
self.circleSlider.value = Float(self.reviwesRoundTwo[0])
})
but only last slide shows the correct
complete source
private func buildCircleSliderFoodQSlider() {
self.circleSlider = CircleSlider(frame: self.FoodQSlider.bounds, options: self.sliderOptions)
let delay = 0.1 * Double(NSEC_PER_SEC)
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
dispatch_after(time, dispatch_get_main_queue(), {
self.circleSlider.value = Float(self.reviwesRoundTwo[0])
})
self.FoodQSlider.addSubview(self.circleSlider!)
self.valueLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
self.valueLabel.textAlignment = .Center
self.valueLabel.center = CGPoint(x: CGRectGetWidth(self.circleSlider.bounds) * 0.5, y: CGRectGetHeight(self.circleSlider.bounds) * 0.5)
self.valueLabel.text = String(reviwesRoundTwo[0])
self.circleSlider.addSubview(self.valueLabel)
}
Will the library work in new Xcode and Swift 4 environments?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.