Question

Is there a way to remove tap gesture recognition for partial curl transition? Right now when user taps on curled view it curls back - dismisses.

I'm using it for quick sign up controller and I don't want users to accidentally tap and return without warning.

Was it helpful?

Solution

For anyone trying to get Hitendra's answer to work you have to place your code after the viewDidLoad. I had success using the viewDidAppear function.

Here is a swift implementation also:

private func removePartialCurlTap() {
  if let gestures = self.view.gestureRecognizers as? [UIGestureRecognizer] {
    for gesture in gestures {
      self.view.removeGestureRecognizer(gesture)
    }
  }
}

Place it like so:

override func viewDidAppear(animated: Bool) {
  super.viewDidAppear(animated)
  removePartialCurlTap()
}

OTHER TIPS

When you use the Partial Curl Transition it automatically adds the gestureRecognizer to dismiss on touch into the gestureRecognizers array of the next screen. You can easily see that adding a breakpoint to viewDidAppear() and use this code in the console as you can see in my print
po self.view.gestureRecognizers

console

Now add this code to the beginning of your viewDidAppear()
self.view.gestureRecognizers?.removeAll()

Also, if you want to return to previous screen using a button with curl down animation, you can easily use this code in the action method of your button
self.dismissViewControllerAnimated(true, completion: {})

for(UIGestureRecognizer *gesture in [yourview gestureRecognizers])
{
    if([gesture isKindOfClass:[UIGestureRecognizer class]])
    {
        [yourview removeGestureRecognizer:gesture];
    }
}

please try above code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top