objective c - Combine UIPageViewController swipes with iOS 7 UINavigationController back-swipe gesture -
i have navigation controller pushes view-controller (parent) contains uipageviewcontroller (pages). used pan/swipe gestures switch between children of page-view-controller. however, can no longer pop parent-view controller using swipe gesture left border of screen, because interpreted gesture in pages.
is possible accomplish swipe-to-pop when left-most view-controller shown?
two ideas:
return nil in
pageviewcontroller:viewcontrollerbeforeviewcontroller
-> doesn't work.restrict touch area, described here.
or there more straightforward way?
i had same situation @smallwisdom, handled differently.
i have view controller a
push on top of navigation controller's stack. view controller a
contains horizontal scroll view stretches way left side of screen right.
in scenario, when wanted swipe screen pop view controller a
navigation controller's stack, ended doing scrolling horizontal scroll view.
the solution pretty simple.
inside view controller a
, have code this:
_contentscrollview = [[uiscrollview alloc] init]; [self.view addsubview:_contentscrollview]; (uigesturerecognizer *gesturerecognizer in _contentscrollview.gesturerecognizers) { [gesturerecognizer requiregesturerecognizertofail:self.navigationcontroller.interactivepopgesturerecognizer]; }
it works great. does? telling scrollview's gesture recognizers have wait see if other gesture recognizer recognize current gesture.
if other fails recognize, no longer have wait , can try recognize current gesture.
if other recognizer succeeds , recognizes current gesture, of gesture recognizers have been waiting automatically fail.
this other gesture recognizer have wait set navigation controller's interactivepopgesturerecognizer. in charge swipe-to-go-back gestures.
Comments
Post a Comment