swift - Pop view controller using Screen edge pan gesture recogniser not following the thumb -
as i've added custom bar navigation bar button item i've lost ability use default function go back. i'd have ability use "swipe edge" go back.
i've added edge pan gesture recogniser , connected @ibaction, dismissing action happens pan gesture recognised.
instead of following thumb (as seen in other apps), current view moves out predefined animation.
how make animation following thumb using edge pan gesture recogniser?
@ibaction func edgeswipe(sender: anyobject) { navigationcontroller?.popviewcontrolleranimated(true) }
there's no need add edge pan gesture recogniser. following @beyowulf's suggestions i've been able implement swipe go feature behaves same way default system implementation - views edge follows thumb swipe dismiss it.
so i've removed screenedge pan gesture recogniser
storyboard , removed related @ibaction
.
i've made first view controller delegate interactivepopgesturerecognizer
. here's code:
class viewcontroller: uiviewcontroller { override func viewdidload() { super.viewdidload() navigationcontroller?.interactivepopgesturerecognizer?.delegate = self } } extension viewcontroller: uigesturerecognizerdelegate { func gesturerecognizershouldbegin(gesturerecognizer: uigesturerecognizer) -> bool { return navigationcontroller?.viewcontrollers.count > 1 ? true : false } }
Comments
Post a Comment