2011-10-12 14 views
5

現在、モーダルビューとポップオーバーに問題があります。それは同じ問題かもしれませんが、わかりません。Xcode(iPad)のモーダルビューの表示スタイルとトランジションスタイルを変更できません

モーダルビューで問題が発生するのは、アニメーションやトランジションスタイルを変更できないことです。たとえば、私は

self.modalPresentationStyle = UIModalPresentationPageSheet; 
self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
[self presentModalViewController:IpModal animated:YES]; 

と書いていますが、モーダルビューは元のトランジションスタイルでフルスクリーンで表示されます。

また、私がpopoversで持っている問題はかなり似ています。パラメータとして "NO"を指定してdismissPopover:animated:メソッドを呼び出すとしても、遷移はまだアニメーション化されています。

ありがとうございます。

答えて

1

presentModalViewController:animated:ではなく、表示する場所に応じて、これら2つの方法のいずれかを使用して、ポップオーバーコントローラを表示することができます。

– presentPopoverFromRect:inView:permittedArrowDirections:animated: 
– presentPopoverFromBarButtonItem:permittedArrowDirections:animated: 
24

modalPresentationStylemodalTransitionStyleコントローラは提示をしていない、モーダル提示するビューコントローラに適用されます。

あなたのコードは、私がカスタムセグエでこれをやった

IpModal.modalPresentationStyle = UIModalPresentationPageSheet; 
IpModal.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
[self presentModalViewController:IpModal animated:YES]; 
+0

+1これは、デスティネーションのviewcontrollerにスタイルを設定して、それを自分自身に設定することによって解除する場合にも機能します。例えば、フォースタッチを介してビューコントローラをプレビューする場合、宛先側で行うことによって、ディスミッシングの遷移を柔軟に設定できるように見えます。 – haxpor

4

でなければなりません。

UIViewController* src = self.sourceViewController; 
UIViewController* dst = self.destinationViewController; 

src.modalPresentationStyle = UIModalTransitionStyleFlipHorizontal; 
dst.modalPresentationStyle = UIModalTransitionStyleFlipHorizontal; 
[src presentModalViewController:dst animated:YES]; 
2
#import yourViewController.m //already present 
#import destinationVieController.m //to be added by programmer 

//custom function to call destination controller 

-(void)callDestinationViewController{ 

    destinationViewController *dest = [[destinationViewController alloc] initWithNibName:@"destinationViewController" bundle:nil]; 

    dest.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
    [self presentModalViewController:dest animated:YES]; 

    } 

//custom function can be called on event fire or action call 

これが役に立てば幸い!

関連する問題