我创建了屏幕上的圆圈手指时的touchesBegan():创建具有PanGestureRecognizer一个UIView并激活它没有通过手指的位置创建一个UIView提升
在视图控制器:
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
for touch in touches {
let pos = touch.locationInView(view)
let radius: CGFloat = touch.majorRadius * 2
let circleView = CircleView(frame: CGRectMake(pos.x - radius/2, pos.y - radius/2, radius, radius))
view.addSubview(circleView)
}
}
在CircleView:
override init(frame: CGRect) {
super.init(frame: frame)
let recognizer = UIPanGestureRecognizer(target: self, action: Selector("handlePan:"))
recognizer.delegate = self
self.addGestureRecognizer(recognizer)
}
这就造成了CIR但是,当我移动手指时,不会立即移动它。相反,我必须拿起手指放回到handlePan()开始前的圆上。
是否有办法开始跟踪平移手势,而不会抬起产生其父视图的手指,同时考虑到可能有多个手指触摸并在屏幕上移动?
如果有多于一个手指接触怎么办? – marsman12019