1

I am trying to allow the "Swipe to go back" feature found in iOS 7+, but it isn't working in my app. I have added

 nc.interactivePopGestureRecognizer.delegate = (id<UIGestureRecognizerDelegate>)self;
    [nc.interactivePopGestureRecognizer setEnabled:YES];

but it simply refuses to work. I have a navigation controller at startup and then I have the "present as popover" segment from view to view. Is there any way I can get an error message or an NSLog to detect why it isn't working?

Greg Henlow
  • 23
  • 1
  • 5

1 Answers1

2

No code changes should be necessary for this feature. If you push a view controller onto a navigation stack, it should just work. Rather than trying to figure out the code to make it work, you'll need to find out what you did to break it.

This feature is designed to work with view controllers pushed onto the navigation controller. You shouldn't use "Present as Popover" for that. If you're setting up a segue in IB, just select the Show option. Popovers aren't dismissed with a Back button.

Dave Batton
  • 8,795
  • 1
  • 46
  • 50
  • So I did what you said and selected the Show option. However, I have never been able to get the swipe to go back feature to work, so I have no idea what I could have done to break it. Can you possibly walk me through laying out view controllers to get it to work properly so that I can figure out what I must have done to break it. – Greg Henlow Jun 09 '15 at 17:06
  • Could it be because I have a tableview on both of my view controllers? Is there some scroll view interference? – Greg Henlow Jun 09 '15 at 17:39
  • No, I don't it would be that easy to confuse it. Create a new project in Xcode from the Master Detail template. Launch it on your iPhone or the iPhone simulator. Does it work there for you? – Dave Batton Jun 09 '15 at 18:27
  • That works. I'm trying to retrace my steps. I've created a nav controller hooked to a view controller and another nav controller and another view controller. The only difference is that the nav bar is not showing...but it still won't work... – Greg Henlow Jun 09 '15 at 19:11
  • You should only have one navigation controller in that setup. Just push the second view on the first navigation controller. – Dave Batton Jun 09 '15 at 19:39
  • Ok. Now I have one nav and two view controllers...but I still can't get it to work. I have even tried the solutions at http://stackoverflow.com/questions/26332216/how-to-hide-navigation-bar-without-losing-slide-back-ability. This is so frustrating. – Greg Henlow Jun 09 '15 at 20:13
  • Ok....I've created a new single view project now. I put a nav controller root linked to a view controller and modal linked to another. That is not working either. – Greg Henlow Jun 09 '15 at 20:23
  • Post it somewhere and I'll take a look. – Dave Batton Jun 09 '15 at 20:24
  • Go to www.blahblahvvv.netne.net/test.zip – Greg Henlow Jun 09 '15 at 20:31
  • 1
    The first thing I see in your build messages is a warning that says "Modal Segues Are Deprecated." Don't ignore that. I changed the segue to "Show (e.g. Push)" and swipe to go back works great. – Dave Batton Jun 09 '15 at 21:19