Sometimes you need to add gestures to the ScrollView to get a click, and then to put the keyboard back on, use the add gesture. However, there will be some follow-up problems, such as intercepting all the other clickable controls on ScrollView, and you may be able to set some properties of the gesture control. But it is not enough to set the properties of Uigesturerecognizer, for example:
screentouch.numberoftapsrequired = 1;
[Screentouchsetcancelstouchesinview:no];
This sometimes intercepts the Uitextfield button that clears the text. At this point, we need the following method to fundamentally handle the gesture response event method.
1, in. h
Add <UIGestureRecognizerDelegate> delegate to the header file
2. Add the implementation method to the. M body file ————
When an event is judged to be a gesture, enter the gesture proxy method first. This method determines whether the clicked view is a button if the button returns no, the gesture does not respond to the event, and it does not cancel the delivery of the event, since it is not responding. The button receives the event and processes it.
#pragma mark-uigesturerecognizerdelegate
-(BOOL) Gesturerecognizer: (Uigesturerecognizer *) Gesturerecognizer Shouldreceivetouch: (Uitouch *) touch
{
Judging is not UIButton class
if ([Touch.view Iskindofclass:[uibutton class]])
{
return NO;
}
Else
{
return YES;
}
}
3, after such a toss, the biggest feeling is that there are solutions to all things, do not give up easily, to more search network resources.
IOS using the custom Gesture Mask button workaround/uitapgesturerecognizer Mask button