Can't change the presentation and transition styles of modal views in Xcode (iPad)
Solution 1
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];
Solution 2
I did this in custom segue.
UIViewController* src = self.sourceViewController;
UIViewController* dst = self.destinationViewController;
src.modalPresentationStyle = UIModalTransitionStyleFlipHorizontal;
dst.modalPresentationStyle = UIModalTransitionStyleFlipHorizontal;
[src presentModalViewController:dst animated:YES];
Solution 3
#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
Hope This Helps !
Solution 4
Perhaps you could try using one of these two methods to present the popover controller, depending on where you want it to appear, rather than presentModalViewController:animated:
.
– presentPopoverFromRect:inView:permittedArrowDirections:animated:
– presentPopoverFromBarButtonItem:permittedArrowDirections:animated:
Related videos on Youtube
Dan Cearnau
Updated on June 04, 2022Comments
-
Dan Cearnau almost 2 years
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.
-
haxpor almost 6 years@LanceSamaria If I recall it correctly. It's also flexible to set dismissing transition style at the destination VC ; in my case the VC that is going to be shown. So no for management code at the originated VC where it presents another.