Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't change the presentation and transition styles of modal views in Xcode (iPad)

I'm currently having some trouble with modal views and popovers. It might be the same problem, but I'm not sure.

The problem I'm having with modal views is that I can't change the animation or transition style. For instance, I write

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

but the modal view still appears full screen with its original transition style.

Also, the problem I'm having with popovers is pretty similar. Even though I call the dismissPopover:animated: method with "NO" as the parameter, the transition is still animated.

Thanks in advance.

like image 252
Dan Cearnau Avatar asked Oct 12 '11 13:10

Dan Cearnau


1 Answers

modalPresentationStyle and modalTransitionStyle apply to the view controller that is to be presented modally, not the controller doing the presenting.

Your code should be

IpModal.modalPresentationStyle = UIModalPresentationPageSheet;
IpModal.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:IpModal animated:YES];
like image 69
jrturton Avatar answered Oct 20 '22 22:10

jrturton