NYTPhotoViewer icon indicating copy to clipboard operation
NYTPhotoViewer copied to clipboard

Can't dismiss `NYTPhotosViewController`.

Open lynn87 opened this issue 7 years ago • 5 comments

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 and UIGestureRecognizerStateEnded)
  • 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].

lynn87 avatar Dec 15 '17 08:12 lynn87

+1

fysteven avatar Jul 24 '18 09:07 fysteven

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.

chadpod avatar Apr 05 '19 00:04 chadpod

Is there a workaround or a fix for this?

Xendrez avatar Jan 03 '20 08:01 Xendrez

I found my answer in example code:

func photosViewControllerDidDismiss(_ photosViewController: NYTPhotosViewController) {
        photoViewerCoordinator = nil
    }

Xendrez avatar Jan 03 '20 09:01 Xendrez

Is there any good solution?

CJaeson avatar Aug 18 '23 06:08 CJaeson