2012-03-19 8 views
1

私のビューでイメージを使用してアニメーションを作成しようとしましたが、動作しません。イメージはアニメーションなしの最終位置にあります。UIModalTransitionStyleFlipHorizo​​ntalで表示されたビューでアニメーションが機能しない

UIImage *myImg = [UIImage imageNamed : @"Img72.png"]; 
UIImageView *myImgView =[ [UIImageView alloc] initWithImage: myImg ]; 
myImgView.frame= CGRectMake(250,50,72,72); 
[self.view addSubview:myImgView]; 

[UIView animateWithDuration:0.5 
         delay: 0.0 
        options: UIViewAnimationOptionCurveEaseInOut 
       animations:^{ 
        [UIView setAnimationRepeatCount:100.0]; 
        [UIView setAnimationRepeatAutoreverses:YES]; 
        myImgView.frame= CGRectMake(50,250,72,72); 
       } 
       completion:NULL]; 
[myImgView release]; 

別のビューでも同じアニメーションコードが完全に機能します。私は最終的にそれは私がこのコードでビューを表示する方法から来ていることを見つける:

FlipsideViewController *controller = [[[FlipsideViewController alloc] initWithNibName:@"FlipsideViewController" bundle:nil] autorelease]; 
controller.delegate = self; 
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; //KO 
[self presentModalViewController:controller animated:YES]; 

問題がmodalTransitionStyleです。私がラインをコメントすると(// KO)、最終的に動作します。私はviewDidLoadProject(ユーティリティアプリケーション)を作り、ちょうどviewDidLoad方法で2つのビューでのアニメーションのコードを追加し

を他の遷移スタイルをテストし、すべての他の作品(UIModalTransitionStyleCoverVerticalUIModalTransitionStyleCrossDissolveUIModalTransitionStylePartialCurl)。

問題はどこですか? Appleのバグですか?フリップ・トランジションとアニメーションを2番目のビューで動作させるにはどうすればいいですか?ここで

は、私の例のプロジェクトです:http://dl.dropbox.com/u/9204589/testFlipAnimation.zip

答えて

2

すべてのシステムのものが行われたときのインターフェイスで再生を開始するために、より自然なようで、didAppearは、私は信じて、その目的のために使用しなければならない(はい、それは動作します:) )

FlipsideViewController.m

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view, typically from a nib. 
} 

-(void)viewDidAppear:(BOOL)animated 
{ 
    UIImage *myImg = [UIImage imageNamed : @"Img72.png"]; 
    UIImageView *myImgView =[ [UIImageView alloc] initWithImage: myImg ]; 
    myImgView.frame= CGRectMake(250,50,72,72); 
    [self.view addSubview:myImgView]; 


    [UIView animateWithDuration:0.5 
          delay: 0.0 
         options: UIViewAnimationOptionCurveEaseInOut 
        animations:^{ 
         [UIView setAnimationRepeatCount:100.0]; 
         [UIView setAnimationRepeatAutoreverses:YES]; 
         myImgView.frame= CGRectMake(50,250,72,72); 
        } 
        completion:NULL]; 
    [myImgView release]; 


    [super viewDidAppear:animated]; 
} 
+0

YEEEEESSSSSS、それはとても簡単だった:-)あなたの迅速かつ完璧な答えてくれてありがとう。フランスで言うように "J'avais latêtedans le guidon" – Alex

+0

ブルズアイ!ちょうど私が欲しいもの – Siddharthan

関連する問題