我正在尝试iOS中的旋转轮概念。我的基础教程是here
UIControl是这里的核心。Superview的userinteraction始终处于禁用状态。
那么如何为它的子视图单独启用userinteraction呢?

我已经在SmallRoundViews中添加了UITapGestureRecognizer。手势不起作用。
如果我将superview的用户交互更改为启用,则手势可以正常工作。但是,它并没有旋转。
如果我将superview的用户交互更改为禁用,则旋转正在工作。但是手势不起作用。
我需要把所有事情都做完。你能给我指路吗?
发布于 2018-01-02 00:20:11
以下代码是有效的,
如果我将superview的userinteraction更改为true,UITapGestureRecognizer和spinning都可以工作。
重写UIControl子类中的UITouch方法。
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
let touch : UITouch = touches.first!
self.beginTracking(touch, with: event)
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
let touch : UITouch = touches.first!
self.continueTracking(touch, with: event)
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
let touch : UITouch = touches.first!
self.endTracking(touch, with: event)
}https://stackoverflow.com/questions/48022776
复制相似问题