You need to process your strokes in the supervisor, and not in the view that you want to disable. This will allow you to turn off viewing without losing touch. When you do this, you will have to check yourself if a touch occurs in a specific sub-item that you want to disable. You can do this in many ways, but here are a few ways to get you started:
Converting objects / points to another representation:
[view convertRect:rect toView:subview]; [view convertPoint:point toView:subview];
Here are some ways to check if a point is in a view:
[subView hitTest:point withEvent:nil]; CGRectContainsPoint(subview.frame, point);
In general, it is better to use UIGestureRecognizers. For example, if you use UIPanGestureRecognizer, you must create a method that the gesture recognizer can recognize, and in this method you do your job. For example:
- (void) viewPanned:(UIPanGestureRecognizer *)pan{ if (pan.state == UIGestureRecognizerStateBegan){ CGRect rect = subView.frame; newView = [[UIView alloc] initWithFrame:rect]; [subView removeFromSuperview]; [self addSubview:newView]; } else if (pan.state == UIGestureRecognizerStateChanged){ CGPoint point = [pan locationInView:self]; newView.center = point; } else {
Then you start the recognizer, assign it to the target (usually self) and add it:
[self addGestureRecognizer:[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(viewPanned:)]];
Now self (which will control the supervisor above it) will respond to pan movements.
Aaron hayman
source share