我的ViewController上有很少的UIView 我怎样才能检查他们现在是否全部接触过?它们被放置在屏幕的不同侧面,每个都必须用分开的手指触摸
答案 0 :(得分:1)
使用touchesEnded委托
override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
startTouchPosition = touches.first?.locationInView(self)
let touch = touches.first
if let touchPoint = touch?.locationInView(self){
for view in self.views{
if(view.containsPoint(touchPoint)){
}
}
}
}