See the app now more and more popular gesture sliding to achieve pop effect, in the heart is itching eager, after a multi-view material, finally found in Jane book detailed implementation of the program:
Easy Learning II--ios using runtime custom controller pop gesture animation
Modified to implement a simple (custom navigation Controller) gesture swipe to achieve the pop return effect:
1. The interactivepopgesturerecognizer,log results of the navigation controller are printed first:
<UIScreenEdgePanGestureRecognizer:0x7fe5f1579ce0; state = Possible; Delaystouchesbegan = YES; View = <uilayoutcontainerview 0x7fe5f1567ea0>; target= < (action=handlenavigationtransition:, target=<_uinavigationinteractivetransition
2. Custom Uipangesturerecognizer, counter switch to the target of the gesture and action;action good processing, but Target's live with runtime can be obtained, but the process is slightly complicated,
Print interactivepopgesturerecognizer.delegate; found just as well as _uinavigationinteractivetransition, so problem solving:
ID target = self.interactivePopGestureRecognizer.delegate;
Uipangesturerecognizer *pan = [[Uipangesturerecognizer alloc] Initwithtarget:target action:nsselectorfromstring (@ " Handlenavigationtransition: ")];
3. Test found that if the current navigation controller's self-controller only one time, the drag gesture will be a bug, then need diarrhea pan gesture
-(BOOL) Gesturerecognizershouldbegin: To determine whether the gesture action works:
-(BOOL) Gesturerecognizershouldbegin: (Uigesturerecognizer *) Gesturerecognizer
{
return self.childviewcontrollers.count==1?no:yes;
}
4. Attach a more perfect classification method for Forkingdog on GitHub:
Https://github.com/forkingdog/UITableView-FDTemplateLayoutCell
Tip: Related bug tips, if you customize the navigation controller's self-controller leftbarbuttonitem, may cause the edge sliding pop effect failure, is due to
Reasons for Self.interactivePopGestureRecognizer.delegate being delayed
(Navigation controller view) full screen swipe for pop effects