(Navigation controller view) full screen swipe for pop effects

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.