1- (void) Setupgetsinnav2 {3Uigesturerecognizer *gesture =Self.interactivepopgesturerecognizer;4gesture.enabled =NO;5UIView *gestureview =Gesture.view;6 7Uipangesturerecognizer *poprecognizer =[[Uipangesturerecognizer alloc] init];8Poprecognizer.Delegate=Self ;9Poprecognizer.maximumnumberoftouches =1;Ten [Gestureview Addgesturerecognizer:poprecognizer]; One /** A * Gets the target array of system gestures - */ -Nsmutablearray *_targets = [gesture Valueforkey:@"_targets"]; the /** - * Get its unique object, we know it is a private class called Uigesturerecognizertarget, it has a property called _target - */ - IDGesturerecognizertarget =[_targets Firstobject]; + /** - * Get _target:_uinavigationinteractivetransition, it has a method called Handlenavigationtransition: + */ A IDNavigationinteractivetransition = [Gesturerecognizertarget valueforkey:@"_target"]; at /** - * from the front of the print, we get it from the console with its method signature. - */ -SEL handletransition = nsselectorfromstring (@"handlenavigationtransition:"); - /** - * Create a gesture that is identical to the system, we only change its class to Uipangesturerecognizer in */ - [Poprecognizer addtarget:navigationinteractivetransition action:handletransition]; to +}
1 -(BOOL) Gesturerecognizershouldbegin: (Uigesturerecognizer *) gesturerecognizer {2 /* * 3 * There are two conditions that do not allow gesture execution, 1, the current controller is the root controller, 2, if this push, pop animation is executing (private property)4 * / 5 return1 &&![ [Self Valueforkey:@ "_istransitioning"] boolvalue]; 6 }
Just add the top code to the global navigation controller
How IOS can slide back in the entire screen