我需要在用户用两根手指触摸屏幕时应用一个函数。
我的问题是屏幕有一个 UITextView
。
屏幕上还存在事件键盘,这就是通常的方法 (UITapGestureRecognizer
) 不适用于此配置的原因。
我该怎么做?
谢谢。
最佳答案
您需要将 UITapGestureRecognizer
添加到 UITextView
。
这是你必须做的:
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(respondToTap)];
[singleTap setNumberOfTapsRequired:2];
[self.yourTextView addGestureRecognizer:tapRecognizer];
-(void)respondToTap{
//do whatever you have to when textfield is double tapped
}
关于objective-c - 在 UITextView 上用两根手指转发事件触摸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9348350/