0
如何在按下时移动按钮?如何移动UIButtons?
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
if let touch = touches.first {
location = touch.locationInView(self.view)
Button.center = location
}
super.touchesBegan(touches, withEvent:event)
}
override func touchesMoved(touches: Set<UITouch>, withEvent event: UIEvent?) {
if let touch = touches.first {
location = touch.locationInView(self.view)
Button.center = location
}
super.touchesMoved(touches, withEvent:event)
}
该按钮不动。