2011-09-12 7 views
8

私は現在、coverVerticalアニメーションで表示されたformSheetスタイルのモーダルUIViewControllerを表示しています。プレゼンテーションスタイルにはcurrentContext、アニメーションスタイルにはflipHorizo​​ntalを使用して、別のモーダルUIViewControllerを提示しようとしています。それはうまくいきますが、フリップの後ろに白い背景がしっかりとしています。 formSheetスタイルの既存のモーダルUIViewControllerのflipHorizo​​ntalスタイルを使用して別のフォームシートのモーダルUIViewControllerを正常に表示する方法についてのアドバイスをいただければ幸いです!おかげ現在のフォームシートモーダルViewController horizo​​ntal flip

コード:

// Loading of first modalVC 
- (void)showModalVC { 

    Modal1VC *modal1VC = [[Modal1VC alloc] init]; 
    modal1VC.modalPresentationStyle = UIModalPresentationFormSheet; 
    modal1VC.modalTransitionStyle = UIModalTransitionStyleCoverVertical; 
    [self presentModalViewController:modal1VC animated:YES]; 
    [modal1VC release]; 

    modal1VC.view.superview.bounds = CGRectMake(0, 0, 400, 400); 
} 

// Loading of second modalVC in Modal1VC 
- (void)buttonTapped:(id)sender { 

    UIViewController *modal2VC = [[UIViewController alloc] init]; 
    modal2VC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 
    modal2VC.modalPresentationStyle = UIModalPresentationCurrentContext; 
    modal2VC.view.backgroundColor = [UIColor greenColor]; 
    [self presentModalViewController:modal2VC animated:YES]; 
    [modal2VC release]; 

    modal2VC.view.superview.bounds = CGRectMake(0, 0, 400, 400); 
} 
+0

ここに... – Nekto

+0

同じ問題をコードの現在のバージョンを投稿!しかし、@ superjessiは、白がウィンドウの色であることは間違いありません。 ClearColorに設定した場合、BLACK :( –

答えて

0

presentModalViewController:animated:の制限であるように思われます。

[self presentModalViewController:modal2VC animated:YES]の代わりに、UIViewアニメーションを使用して効果を得ることができます。おそらく次のようなものでしょう:

[UIView transitionWithView:self.view.window 
        duration:0.3 
        options:UIViewAnimationOptionTransitionFlipFromRight 
       animations:^{ 
    [self presentModalViewController:modal2VC animated:NO]; 
} completion:NULL]; 
+0

申し訳ありませんが、これは機能しません。 – CastToInteger

1

トランジションが動作しているように聞こえますが、フリップトランジションに表示される白い背景が問題ですか?

フリップトランジション中に表示される白い背景は、実際にはwindowです。表示される色はbackgroundColorプロパティwindowAppDelegateに設定して変更できます。

+0

これはどちらでも動作しません – CastToInteger

4
UIViewController *presentingViewController = //allocate your VC 
[modalViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal]; 
UIViewController *modalViewController = //your modal VC 
[presentingViewController presentModalViewController:modalViewController animated:YES]; 

これはあなたが必要なすべてのコードです;)

関連する問題