NYTPhotoViewer
NYTPhotoViewer copied to clipboard
Can't dismiss `NYTPhotosViewController`.
System Version:
iOS 11.2
Reproduce Steps:
- View photo with
NYTPhotosViewController
- Do pan gesture a little(must a little, this can make
didPanWithGestureRecognizer
method called only twice,UIGestureRecognizerStateBegan
andUIGestureRecognizerStateEnded
) - Dismiss
NYTPhotosViewController
with close button failed
Reason
The method startInteractiveTransition
in NYTPhotoDismissalInteractionController
called later than finishPanWithPanGestureRecognizer
. The property transitionContext
is nil when execute code [self.animator animateTransition:self.transitionContext]
.
+1
Seeing same issue, startInteractiveTransition:
isn't called until after the first couple of didPanWithPanGestureRecognizer:viewToPan:anchorPoint:
calls so transitionContext
is nil in didPanWithPanGestureRecognizer:viewToPan:anchorPoint:
in those cases. Happens for me with a quick flick to dismiss. Image just ends up stuck. Seems to be internal to iOS as startInteractiveTransition:
is called by the system in response to dismissViewControllerAnimated:completion:
. The approach used in the the pan gesture handler seems to be what all the examples are like ... so not sure why the delay in startInteractiveTransition:
being called. Any insight would be appreciated.
Is there a workaround or a fix for this?
I found my answer in example code:
func photosViewControllerDidDismiss(_ photosViewController: NYTPhotosViewController) {
photoViewerCoordinator = nil
}
Is there any good solution?