簡體   English   中英

ios開發UIPanGesture

[英]ios dev UIPanGesture

我正在嘗試使用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秒鍾的動畫時間; 你告訴過的 嘗試調用self.boxView.center = CGPointMake(self.boxView.center.x, move); 沒有[UIView animateWithDuration...]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM