- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
AppDelegate * app = (AppDelegate *)[UIApplication sharedApplication].delegate;
UIWindow * window2 = app.window;
UITouch * touch = touches.anyObject;
CGPoint location2 = [touch locationInView:window2];
NSLog(@"%@",NSStringFromCGPoint(location2));
if (location2.x > 40 && location2.x < APP_WIDTH-40) {
self.isPanGestureDidPan = NO;
} else {
self.isPanGestureDidPan = YES;
}
}
同时加一个属性,定义为BOOL即可,通过这个BOOL值在下面的方法中判断,如果是NO直接return即可。
- (void)gestureRecognizerDidPan:(UIPanGestureRecognizer *)panGesture
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
AppDelegate * app = (AppDelegate *)[UIApplication sharedApplication].delegate;
UIWindow * window2 = app.window;
UITouch * touch = touches.anyObject;
CGPoint location2 = [touch locationInView:window2];
NSLog(@"%@",NSStringFromCGPoint(location2));
if (location2.x > 40 && location2.x < APP_WIDTH-40) {
} else {
[super touchesBegan:touches withEvent:event];
}
}