objective c - Back swipe gesture is not work when I add the leftBarButtonItem -
here viewcontrollera
push viewcontrollerb
, , in viewcontrollerb
leftbarbuttonitem
set following:
self.navigationitem.leftbarbuttonitem = [[uibarbuttonitem alloc] initwithtitle:@"back" style:uibarbuttonitemstyleplain target:self action:@selector(backbtnclicked:)];
after setting leftbarbuttonitem
, swipe gesture not work. possible keep swipe gesture?
because you've changed left bar button item, you're telling navigation controller stop managing navigation-based back-actions user can take.
to fix it, can tell navigation controller continue accepting gestures on current view controller using:
self.navigationcontroller.interactivepopgesturerecognizer.delegate = self;
where self
if view controller.
uiviewcontroller
privately implements uigesturerecognizerdelegate
, you'll warning this, can mitigate adding in protocol conformance (<uigesturerecognizerdelegate>
) header, or class extension.
Comments
Post a Comment