0
votes

I want to implement slide down interaction and dismiss view controller, for which i referred this link , but this works only for dismissing a single view controller presented from view controller.

In my case, i have presented a navigation controller as user can push to another view from that view controller, but drag down to dismiss doesn't work with navigation controller.

UPDATED:It should work as - slide down gesture is triggered from any of the screens, (for eg: from main screen or pushed screen/detail screen) the navigation controller should dismiss completely.

Please suggest if anyone has come across implementing the same.

Thanks in advance.

1
You need to show what you are doing in order for someone to figure out what's missing. Please share your code - Malik
I have used the same code from the link which i have linked in the question,created ViewControllerPannable class, and used it, but it doesnt seems to work. - khushboo
One thing to keep in mind is that a modal controller and a navigation controller have different ways of dismissing a controller. For a modal controller, you would use dismissViewController whereas in a navigation controller, you would use navigationController.popViewController (because it is pushed onto a navigation stack) - Malik
i have to implement as - on swipe down or panning down the view controller it should dismiss whole navigation controller. - khushboo

1 Answers

-1
votes

You can add PanGesture in your navigation controller. Using - (CGPoint)velocityInView:(UIView *)view you will know in which direct user panned. if view was panned down manage its constraint accordingly and if it is more than a threshold value pop that view.