0

UIView サブクラスで私はこれを持っています:

self.frontImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"front"]];
self.backImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"back"]];
[self addSubview:self.backImageView];


[UIView animateWithDuration:0.5
                          delay:0.0
                        options:UIViewAnimationOptionTransitionFlipFromLeft
                     animations:^{
                         [self.backImageView removeFromSuperview];
                         [self addSubview:self.frontImageView];}

                     completion:^(BOOL finished){
                         //nothing
                     }];

しかし、フリップ アニメーションが表示されません。正面の画像ビューがすぐに表示されます。私は何を間違っていますか?

4

1 に答える 1

2

あなたは愚かな間違いを犯しています

animateWithDuration:delay:options:animations:completion:

それ以外の

transitionFromView:toView:duration:options:completion:

コードは次のようになります。

[UIView transitionFromView:backImageView
                    toView:frontImageView
                  duration:0.5
                   options:UIViewAnimationOptionTransitionFlipFromLeft
                completion:^(BOOL finished) {
                    // animation completed
                }];
于 2013-02-22T20:07:56.080 に答える