0

高さと位置を変更して UIView をアニメーション化しようとしています。アニメ初ジャンプ?ストーリーボードで UIView (theView) のサイズを高さ 216 に設定しています。そのため、アプリが読み込まれ、theView が表示されます。theView をクリックすると、高さが 200 ピクセル以上に急速にジャンプし、アニメーション化されますか?

- (void)singleTapAction:(UIGestureRecognizer *)singleTap {
UIView *view = singleTap.view;
[UIView animateWithDuration:1.2 delay:0 options:UIViewAnimationCurveLinear | UIViewAnimationOptionAllowUserInteraction animations:^{
    CGRect theFrame = self.theView.frame;
    theFrame.size.height += 100.f;  <!-- when it hits here the view jumps then animates
    self.theView.frame = theFrame;
}
                 completion:^(BOOL finished) {
                     if(finished){
                         [UIView animateWithDuration:1.2 delay:0 options:UIViewAnimationCurveLinear | UIViewAnimationOptionAllowUserInteraction animations:^{
                             CGRect theFrame = self.theView.frame;
                             theFrame.origin.y -= 100.f;
                             self.theView.frame = theFrame;
                         }
                                          completion:^(BOOL finished) {
                                              NSLog(@"animations complete");
                                          }];
                     }
                 }];

}

4

1 に答える 1

0

線を動かしてみる

CGRect theFrame = self.theView.frame;
theFrame.size.height += 100.f;  <!-- when it hits here the view jumps then animates

ブロックの外。アニメーション メソッドが呼び出される前に配置します。

于 2013-02-16T04:00:11.013 に答える