2012-11-09 18 views
0

我正在嘗試使用UIPanGestureRecognizer來移動視圖。我的問題是國家結束了,延遲了1秒。ios dev UIPanGesture

它發生在模擬器。這是正常的嗎?或者我的代碼有問題?

謝謝大家!

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) { 
        }]; 
} 

回答

0

這是因爲它花了最後1秒的動畫;你告訴它。嘗試調用self.boxView.center = CGPointMake(self.boxView.center.x, move);沒有[UIView animateWithDuration...]

+0

當它檢測到結束事件發生延遲。 如果我顯示一條測試消息: if(recognizer.state == UIGestureRecognizerStateEnded){ NSLog(@「Test」); } 還有一個延遲 – AleVasta