Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/113.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何向所有UITextView添加一个UIGestureRecognitor而不阻止textView触摸_Ios_Objective C_Uitextfield_Uigesturerecognizer_Uitapgesturerecognizer - Fatal编程技术网

Ios 如何向所有UITextView添加一个UIGestureRecognitor而不阻止textView触摸

Ios 如何向所有UITextView添加一个UIGestureRecognitor而不阻止textView触摸,ios,objective-c,uitextfield,uigesturerecognizer,uitapgesturerecognizer,Ios,Objective C,Uitextfield,Uigesturerecognizer,Uitapgesturerecognizer,如何向所有UITextView添加一个uigesturecognizer,而不阻止textView触摸 我想在任何人触摸任何UITextView时调用一个方法。请任何人给我答案。 -(BOOL)文本字段应开始编辑:(UITextField*)文本字段 -(BOOL)textfield应该开始编辑:(UITextField*)textField只需使用UITextFieldDelegate方法或在UITextField下添加UIView,并将手势识别器添加到UIView只需使用UITextFiel

如何向所有
UITextView
添加一个
uigesturecognizer
,而不阻止textView触摸

我想在任何人触摸任何UITextView时调用一个方法。请任何人给我答案。


-(BOOL)文本字段应开始编辑:(UITextField*)文本字段

-(BOOL)textfield应该开始编辑:(UITextField*)textField

只需使用
UITextFieldDelegate
方法或在
UITextField
下添加
UIView
,并将手势识别器添加到
UIView

只需使用
UITextFieldDelegate
方法或在
UITextField
下添加
UIView
,并添加手势识别器
ui查看

尝试以下操作:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    NSLog(@"touchesBegan");
}
然后在上述操作中处理以下方法

[super touchesBegan:touches withEvent:event];
您的总体解决方案如下所示:

     #import "YourTextView.h" 

        @implementation YourTextView

        - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    [super touchesBegan:touches withEvent:event];

 NSLog(@"touchesBegan");
        }
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
        NSLog(@"touchesEnded");
        [self.nextResponder touchesEnded: touches withEvent:event]; 
        NSLog(@"touchesEnded");
        [super touchesEnded:touches withEvent:event];
        NSLog(@"touchesEnded");
    }
我希望这对你有帮助:)

试着这样做:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    NSLog(@"touchesBegan");
}
然后在上述操作中处理以下方法

[super touchesBegan:touches withEvent:event];
您的总体解决方案如下所示:

     #import "YourTextView.h" 

        @implementation YourTextView

        - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    [super touchesBegan:touches withEvent:event];

 NSLog(@"touchesBegan");
        }
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
        NSLog(@"touchesEnded");
        [self.nextResponder touchesEnded: touches withEvent:event]; 
        NSLog(@"touchesEnded");
        [super touchesEnded:touches withEvent:event];
        NSLog(@"touchesEnded");
    }

我希望这对你有帮助:)

使用此代码这是委托

<UITextFieldDelegate> 
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField

-(BOOL)textField应该开始编辑:(UITextField*)textField

使用此代码这是委托

<UITextFieldDelegate> 
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField

-(BOOL)textField应该开始编辑:(UITextField*)textField

首先必须添加
uitextfield
委托

<UITextFieldDelegate> 

首先,您必须添加
uitextfield
delegate

<UITextFieldDelegate> 

你的实际问题是什么?你的实际问题是什么。