0

タイマーとアニメーション ブロックを使用して画像ビューを移動しています。同時に、ユーザーはこれらのビュー (ボタン) のいくつかをクリックすると、さまざまな画像ビューの移動/サイズ変更/回転を開始するアニメーション ブロックがさらにいくつかあります。

ビューのアルファを変更し、ビューに新しい CGpoint を与えることは非常にうまく機能しますが、uiview.transform 関数でサイズ変更または回転を呼び出すと、すべてのビューが (ストーリーボードから) 開始位置にリセットされるようです。

アニメーション ブロック内でこの変換関数を使用できるようになりたいと思っていますが、このリセットをバイパスできない場合は、実際には実行可能なオプションではありません。

コード例:

- (void)moveGust:(NSTimer*) timer
{
    if(centerCloud1.x >= 1100)
    {
        centerCloud1.x = -79;
        gustOutlet.center = centerCloud1;
    }
    if(centerCloud2.x >= 1100)
    {
        centerCloud2.x = -79;
        cloudOutlet.center = centerCloud2;
    }

    centerCloud1 = gustOutlet.center;
    centerCloud1.x = round(centerCloud1.x+10);
    centerCloud2 = cloudOutlet.center;
    centerCloud2.x = round(centerCloud2.x+8);

    [UIView animateWithDuration:2 delay:0 options:UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionCurveLinear animations:^(void){
        gustOutlet.center = centerCloud1;
        cloudOutlet.center = centerCloud2;
    }completion:^(BOOL Finished){ }];
}

- (IBAction)signAction:(id)sender {

    [UIView animateWithDuration:0 animations:^(void) {
        signTop.transform = CGAffineTransformScale(signTop.transform, 1.1, 1.1);
    }];
}

何か案は?ありがとう!

4

1 に答える 1

0

連続する変換は、CGAffineTransformConcat() を使用して連結する必要があります。

ビューの変換を新しい変換と同じに設定すると、以前の変換が効果的に「元に戻されます」。一連の変換を行うには、上記の方法でそれらを連結します。

于 2013-08-15T18:01:49.623 に答える