iOS custom full screen return with TableView left stroke Delete gesture conflict resolution

Source: Internet
Author: User

When customizing a Navigationcontroller implementation full-screen right-click Return, it is not very cool to use, the code is as follows:

-(void) viewdidload {    [super viewdidload];    Uigesturerecognizer  *gester = Self.interactivepopgesturerecognizer;
*pangester = [[Uipangesturerecognizer alloc] Initwithtarget:gester. Delegate action:nsselectorfromstring (@ "handlenavigationtransition:")];
[Gester.view Addgesturerecognizer:pangester];
= YES;
Pangester. delegate = self ;}

-(BOOL) Gesturerecognizershouldbegin: (Uigesturerecognizer *) gesturerecognizer{

if (Self.childViewControllers.count = = 1) {

return NO;

}

return YES;

}

then goose, when you open the left in the TableView editing function found dead and alive also left row, swollen fat Four, is open posture is wrong, mgd! Or a gesture conflict?

All right, hit a breakpoint and try it!  Breakpoint after found into the tableview of the editing method, into the custom Navigationcontroller Gesturerecognizershouldbegin method, the original was intercepted. Then judge whether it is left or right, if left row will not intercept, give tableview to respond! The code is as follows:

-(BOOL) Gesturerecognizershouldbegin: (Uigesturerecognizer *) gesturerecognizer{if([Gesturerecognizer Iskindofclass:[uipangesturerecognizerclass]]) {                if(Self.childViewControllers.count = =1 ) {            returnNO; }                if(Self.interactivepopgesturerecognizer &&[[Self.interactivePopGestureRecognizer.view gesturerecognizers] containsobject:gesturerecognizer]) {Cgpoint Tpoint= [(Uipangesturerecognizer *) Gesturerecognizer TranslationInView:gestureRecognizer.view]; if(Tpoint.x >=0) {CGFloat y=fabs (TPOINT.Y); CGFloat x=fabs (tpoint.x); CGFloat af=30.0f/180.0f*M_pi; CGFloat TF=TANF (AF); if((y/x) <=TF) {                    returnYES; }                returnNO; }Else{                returnNO; }        }    }        returnYES;}

It seems to be possible! Oh yes!

But if TableView also has a right stroke ...

The most detailed iOS event delivery and response mechanism in history-principle

iOS custom full screen return with TableView left stroke Delete gesture conflict resolution

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.