我有Label和UIPanGestureRecognizer。拖动到新位置时,我会更改文本,但它会更改并返回默认位置!!
我想更改文字并保持拖动位置
处理代码:
func handlePanGesture(panGesture: UIPanGestureRecognizer) {
var translation = panGesture.translationInView(view)
panGesture.setTranslation(CGPointZero, inView: view)
println(translation)
label.center = CGPoint(x: label.center.x+translation.x, y: label.center.y+translation.y)
label.multipleTouchEnabled = true
label.userInteractionEnabled = true
if panGesture.state == UIGestureRecognizerState.Ended {
label.text = "End Drag"
}}