Home:ALL Converter>Touch events queuing up during Custom Segue?

Touch events queuing up during Custom Segue?

Ask Time:2013-07-02T02:57:31         Author:Electro-Bunny

Json Formatter

I have a tableview A whose row entries custom segue to a GridView B (actually using the open source MMGridView). The subview cells of the gridView/scrollView use touchesBegan/TouchesEnd to detect their selection.

I am using the storyboard, and the custom segues are animated and initiated by didselectrowatindexpath/performsegue in the tableView.

The problem is that once a tableview row has been selected, additional taps are being queued up and passed on to the individual gridCells.

In the custom segue, I have tried setting destinationviewcontroller.view.userInteractionEnabled = NO; And then re-enabling it in the destinationViewController's viewDidAppear. This did not work, and the queued up touch events were still passed on to the gridView's subcells.

How do I flush or cancel any touch events that seemed to have queued up during a custom-animated transition?

EDIT: Removing the custom segue seemed to stop the "queued up" touch event behavior. Or maybe the segue now simply occurs quickly enough so that no touch events are happening during it? For completeness sake, here is my custom uistoryboardsegue that is giving me problems:

#import "QuartzCore/QuartzCore.h"

@implementation TTOCustomSegue

-(void)perform {

UIViewController *sourceViewController = (UIViewController*)[self sourceViewController];
UIViewController *destinationController = (UIViewController*)[self destinationViewController];
//destinationController.view.userInteractionEnabled = NO;

CATransition* transition = [CATransition animation];
transition.duration = .4;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
transition.type = kCATransitionFade; 
transition.subtype = nil;

[sourceViewController.navigationController.view.layer addAnimation:transition forKey:kCATransition];    
[sourceViewController.navigationController pushViewController:destinationController animated:NO];       
}
@end

Author:Electro-Bunny,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/17411680/touch-events-queuing-up-during-custom-segue
yy