2011-01-12 15 views
0

iPad上でiBookストアに似たものを実装しようとしていました。 ブックカバーをタップすると、ブックカバーから空の背景に1つの流体モーションで反転表示され、コンテンツが読み込まれます。はブロック内の他のUIViewAnimationsと混在しています

私は最初に反転し、スケーリングして、別の方法を試しましたが、をanimateWithDurationブロック内にラップしようとしましたが、正しく表示されません。それはどちらか一方を行い、最後の場合は「フリッカー」を行い、何もしません。

[UIView transitionFromView:fromView 
        toView:toView 
        duration:0.8 
        options:UIViewAnimationOptionTransitionFlipFromRight 
       completion:^(BOOL finished) { 
        if (finished) { 
          [UIView animateWithDuration:0.4 
           animations:^{[fromView setFrame:originFrame];} 
           completion:^(BOOL finished){}]; 
        } 
       }]; 

ブロックはアニメーションには間違いありません。 しかし、私は同時にどのようにフリップとスケールすることができますか?

ありがとうございます。

答えて

0

切り替えるビューを含むビューでフリップを実行することで、非ブロックアニメーションを使用してこのエフェクトを作成することができました。

CGRect endFrame; //The frame of the view after animation 
UIView *sview; //The superview containing the first view 
UIView *view1; //The first view, to be removed from sview 
UIView *view2; //The second view, to be added to sview 

view2.frame = view1.frame; 
[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:0.8]; 
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:sview cache:YES]; 
[view1 removeFromSuperview]; 
[sview addSubview:view2]; 
sview.frame = endFrame; 
[UIView commitAnimations]; 

これを行うには、ビュー2の自動サイズ調整マスクの幅と高さを変更できる必要があります。

+0

私はまず午前中にそれを試してみます:)ありがとう。私はまだブロックでそれを行う方法があることを願っています。 – RickiG

関連する問題