ios dev UIPanGesture

时间:2012-11-09 02:03:11

标签: ios uigesturerecognizer

我正在尝试使用UIPanGestureRecognizer来移动视图。我的问题是国家结束了,延迟了1秒。

它发生在模拟器中。这是正常的吗?或者我的代码有问题?。

谢谢大家!

if(recognizer.state == UIGestureRecognizerStateEnded){
    float y = self.boxView.center.y;
    float move = 300;

    [UIView animateWithDuration:1.0 delay:0
                        options:UIViewAnimationCurveEaseOut
                     animations:^ {
                         self.boxView.center = CGPointMake(self.boxView.center.x, move);
                     }
                     completion:^(BOOL finished) {
                     }];
}

1 个答案:

答案 0 :(得分:0)

那是因为它花了最后1秒的动画;你告诉它了。尝试在没有self.boxView.center = CGPointMake(self.boxView.center.x, move);

的情况下致电[UIView animateWithDuration...]