Ok, so it seems like the idea of ββa UIPresentationController CANNOT use it as an extended SplitView (or at least my current output). However, I managed to create a workaround. If someone finds a better way to handle this, please let me know in the comments.
So what I do, I insert the PresentingViewController in the transitionContexts containerView container (same as the UIPresentationControllers containerView) in Index 0. This allows me to transparently handle touchEvents in the PresentingViewControllers. But it removes the PresentingViewControllers view from its original view hierarchy, so I need to move it there when the presentation is fired. This means that the presentation of the view is back to the parentViewController, if present, or to the application window, if presentingViewController is the root controller of the application (there may be other scripts, but this will be done now).
This is all done in animateTransition in UIViewControllerAnimatedTransitioning.
Here's the code snippet:
UIView.animateWithDuration(transitionDuration(transitionContext), delay: 0.0, usingSpringWithDamping: 1.0, initialSpringVelocity: 0.5, options: UIViewAnimationOptions.BeginFromCurrentState|UIViewAnimationOptions.AllowUserInteraction, animations: { () -> Void in animatingView.frame = finalFrame }) { (finished:Bool) -> Void in if !self.isPresentation { if let parentViewController = backgroundVC.parentViewController { parentViewController.view.addSubview(backgroundVC.view) } else if let window = (UIApplication.sharedApplication().delegate as! AppDelegate).window { window.addSubview(backgroundVC.view) } fromView.removeFromSuperview() } else { containerView.insertSubview(backgroundVC.view, atIndex: 0) } transitionContext.completeTransition(true) }
jollyCocoa
source share