I have looked at the other similar questions but didn't find any solution for my code, could someone help me? Thank you!
Here is the code:
import UIKit
let therColor = UIColor.greenColor()
let rMin2 = CGFloat(Int(ViewController().sliderMinOutlet.value))
let rMax2 = CGFloat(Int(ViewController().sliderMaxOutlet.value))
let center2 = CGPoint(x:400, y:400)
let startAngle2 = CGFloat(-M_PI/3)
let endAngle2 = CGFloat(M_PI/3)
let point1contact2 = CGPoint(x:center2.x+rMin2*cos(-startAngle2), y:center2.y-rMin2*sin(-startAngle2))
let point2contact2 = CGPoint(x:center2.x+rMax2*cos(-startAngle2), y:center2.y-rMin2*sin(-startAngle2))
class drawArcs: UIView {
override func drawRect(rect: CGRect) {
let contact2Ther = UIBezierPath()
contact2Ther.moveToPoint(point1contact2)
contact2Ther.addArcWithCenter(center2, radius: rMin2, startAngle: startAngle2, endAngle: endAngle2, clockwise: true)
contact2Ther.moveToPoint(point2contact2)
contact2Ther.addArcWithCenter(center2, radius: rMax2, startAngle: startAngle2, endAngle: endAngle2, clockwise: true)
contact2Ther.closePath()
therColor.setFill()
contact2Ther.fill()
}
}
And here the ViewController:
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var sliderMinOutlet: UISlider!
@IBOutlet weak var sliderMaxOutlet: UISlider!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
This is the code in the ViewController: ViewController code
And this is the code in the UIView class: