I am updating my app to support iOS 8. In a few places, I do a modal presentation after popover dismissal. This is the code I used for iOS 7
[self.POP dismissPopoverAnimated:YES];
// initialization code for self.SMVC
MPTAdvancedSearchNav* nav = [[MPTAdvancedSearchNav alloc]initWithRootViewController:self.SMVC];
nav.modalPresentationStyle = UIModalPresentationFormSheet;
[self.navigationController presentViewController:nav animated:YES completion:nil];
When I run this on an iOS 8 device, I see a lag (about 1/4 of a second) before UIModalPresentationFormSheet animation begins.
I did some research and found this WWDC video https://developer.apple.com/videos/wwdc/2014/#214 (minute 29) that says I should use a transition coordinator to schedule a new presentation after the popover dismissal.
Problem is, I cant figure out how to do this. I think I am supposed to use
- (void)notifyWhenInteractionEndsUsingBlock:(void (^)(id<UIViewControllerTransitionCoordinatorContext> context))handler
Is this the method I should use? Also, how do I get a hold of UIViewControllerTransitionCoordinatorContext
Unfortunately, Popovers were only converted to a "presentation style" in iOS 8, so you'll still need the old code you have for iOS 7, and have a fork in there for iOS 8 specific code. On top of that, in order to make everything work nicely, you'll have to abandon UIPopoverController because it does not inherit from UIPresentationController, which is a requirement to hook into the transitioning system in iOS 8 for popovers specifically. All UIPopoverController does in iOS 8 is wrap UIPopoverPresentationController.
However, I think there's an easier solution that will work nicely in both 7 & 8: have whatever class is doing the creation / presentation of MPTAdvancedSearchNav become the delegate of UIPopoverController, and implement didDismissPopover:, and move your code into there that will do the presentation.
Checkout the docs here, and let me know how that works - https://developer.apple.com/Library/ios/documentation/UIKit/Reference/UIPopoverControllerDelegate_protocol/index.html#//apple_ref/doc/uid/TP40009307