2012-04-24 5 views
0

私はしばらく検索してきましたが、基本的には "presentModalViewController"アニメーションですが、他の方法は...私は画面の一番上を公開してページ。誰がそれが呼ばれているか知っていますか?iPhone subView animation:スライドダウン

これは私がこれまでに持っていたコードですが、それはあまりにも早く起こります...どうすれば遅くなりますか?

-(void)gotToCreateGameViewController{ 
CreateNewGameViewController *newGame = [[CreateNewGameViewController alloc]initWithNibName:@"CreateNewGameViewController" bundle:nil]; 
self.createNewGameViewController = newGame; 
createNewGameViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; 
[self presentModalViewController:newGame animated:YES]; 
[self.view insertSubview:newGame.view atIndex:0]; 

[newGame release]; 

答えて

2

私は、あなたが探していると思う:UIModalTransitionStyleCoverVertical

Presentation Transition Styles 
Transition styles available when presenting view controllers. 

typedef enum { 
     UIModalTransitionStyleCoverVertical = 0, 
     UIModalTransitionStyleFlipHorizontal, 
     UIModalTransitionStyleCrossDissolve, 
     UIModalTransitionStylePartialCurl, 
} UIModalTransitionStyle; 

それは却下すると、その後上から下、提示するために下から上へ行きます。トップからボトムに移行するには、自分自身をロールバックするか、開始vcの下にある宛先vcから開始し、モーダルに開始vcを提示する必要があります。

+0

私が試してみましたいくつかのコードで私の質問を更新しました。 ..それは私がそれを望む方法を働かない – nfoggia

1

はUIModalTransitionStyleのみのiPadアプリケーションのために動作します。このコード

-(void)gotToCreateGameViewController{ 
     CreateNewGameViewController *newGame = [[CreateNewGameViewController alloc]initWithNibName:@"CreateNewGameViewController" bundle:nil]; 
     self.createNewGameViewController = newGame; 

     CATransition *transition = [CATransition animation]; 
     transition.duration = 0.05; 
     transition.timingFunction = [CAMediaTimingFunction  
     functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 
     transition.type =kCATransitionMoveIn; 
     CATransition *transition = [CATransition animation]; 
     transition.duration = 0.05; 
     transition.timingFunction = [CAMediaTimingFunction  
     functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 
     transition.type =kCATransitionMoveIn; 
     transition.subtype =kCATransitionFromTop; 

     transition.delegate = self; 

     transition.subtype =kCATransitionFromTop; 

     transition.delegate = self; 


     [self presentModalViewController:newGame animated:NO]; 
     [self.view insertSubview:newGame.view atIndex:0]; 

     [self.view.layer addAnimation:transition forKey:nil]; 

     [newGame release]; 

注意してみてください。ドキュメンテーションを参照してください。

+0

私はcontainerViewが宣言されていない(魔女ではない)いくつかのエラーを取得していますが、 – nfoggia

+0

@nfoggia更新されたコード。今すぐやってみて下さい – rakeshNS

0

私のハックの答え:

あなたは(あなたはおそらく、そのビューにすべてを切り取って貼り付け、別のビューを追加する必要があります)、Y = 960まであなたの最初のビューを移動し、であなたの2番目のビューを置く場合y = 0の場合、次のコードを実装できます。 BOOL(私はmovedUp鉱山と呼ばれる)インスタンス化後:

-(void)moveView:(float)d{ 
    [UIView beginAnimations:nil context:NULL]; 
    [UIView setAnimationDuration:d]; 

    CGRect rect = self.view.frame; 
    if (!movedUp) 
    { 
     rect.origin.y -= 960; 
     rect.size.height += 960; 
    } 
    else 
    { 
     // revert back to the normal state. 
     rect.origin.y += 960; 
     rect.size.height -= 960; 
    } 
    self.view.frame = rect; 

    [UIView commitAnimations]; 
    movedUp = !movedUp; 
} 
- (void)viewDidAppear:(BOOL)animated 
{ 
    [self moveView:0.0]; 
    [super viewDidAppear:animated]; 
} 

をそれから私は、次のように両方のボタン(各ビューの1)に接続されている:

-(IBAction)setViewMovedUp:(id)sender 
{ 
    [self moveView:0.5]; 
} 
関連する問題