ios – i want to make a hit judgment on a roulette wheel made with swift/charts

https://www.hfoasi8fje3.work/entry/2019/03/04/213142
Draw a pie chart based on and rotate itRoulette appI want to.

Draw pie charts like images using ChartsrotationYou can now do it.
However, I’m looking for the important collision detection, but I can’t find it at all. ..

Who will sign the title Netflix? An arrow mark is installed below.
Angle after roulette rotation stops? I want to judge which item from such.

What should I do?
Is this the correct way to create a roulette app?

Please give me a hint.

import Charts
    @IBOutlet weak var pieChartsView: PieChartView!
    var buttonStartFlg = true
    @IBOutlet weak var startButton: UIButton!
...
// MARK: --Action
    @IBAction func tapStartButton (_ sender: UIButton) {
        let animation = CABasicAnimation (keyPath: "transform.rotation")
        animation.isRemovedOnCompletion = false
        animation.fillMode = CAMediaTimingFillMode.forwards
        if buttonStartFlg {
            startButton.setImage (UIImage (named: "stop"), for: .normal)
            pieChartsView.layer.speed = 2.0
            animation.toValue = .pi/2.0
            animation.duration = 0.1
            animation.repeatCount = MAXFLOAT
            animation.isCumulative = true
            pieChartsView.layer.add (animation, forKey: "ImageViewRotation")
            buttonStartFlg = false
        } else {
            startButton.setImage (UIImage (named: "start"), for: .normal)
            let pausedTime = pieChartsView.layer.convertTime (CACurrentMediaTime (), from: nil)
            pieChartsView.layer.speed = 0.0
            pieChartsView.layer.timeOffset = pausedTime
            buttonStartFlg = true
        }
    }

Latest posts