I created a Gauge using AppCode. Depending on the input, the gauge arrow in the middle rotates. I want to use a slider in Swift to determine how much the arrow in the gauge should rotate. If I hard code the input the arrow rotates to the proper position. For example, if I input 0.5, then the arrow points to the centre of the gauge.
My problem is that my UIView never updates the arrow depending on the new slider position. The arrow is always positioned depending on the UISlider's 'Current' value. How can I get my UIView to update in real time with respect to my UISlider.
I have a feeling that I’m supposed to put my 'drawRect' function in the 'ratingSliderChanged' action function. When I try to do this, my gauge never appears.
import Foundation
import UIKit
class RatingViewController: UIView {
var sliderValue: CGFloat = 0.0
@IBOutlet var newView:UIView!
@IBAction func ratingSliderChanged(sender: UISlider){
sliderValue = CGFloat(sender.value)
println(sliderValue)
}
override func drawRect(rect: CGRect) {
RatingGaugeStyleKit.drawCanvas1(frame: self.bounds, arrowAngle: sliderValue)
}
}
Any Suggestions?