简体   繁体   English

为什么GestureRecognizer第一次在textview上不起作用?

[英]why does GestureRecognizer not work on textview first time?

I have a textView to input some text or emotion . 我有一个textView可以输入一些textemotion so I make another button to change the keyboard to custom emotion view, and I also use tap GestureRecognizer for when I want to change back to keyboard . 因此,我做出了另一个按钮来将键盘更改为自定义情感视图,并且当我想更改回keyboard时也使用tap GestureRecognizer I found every time I need to touch the button twice, the tap GestureRecognizer can work well. 我发现每次需要两次触摸按钮时, tap GestureRecognizer都可以正常工作。 I thought and search long time but no result, finally I fix it. 我想了很长时间,但没有结果,最后我解决了。 I think some one will meet the same question, so I shared it below. 我认为有人会遇到相同的问题,因此我在下面分享。

because my add tap gesture recognition 's code is in init code, but when I tap textview, keyboard was pop up, the textview's position was changed too, so the init tap gesture recognition code isn't work now. 因为我的添加点击手势识别代码是init代码,但是当我点击textview时,弹出了键盘,textview的位置也发生了变化,因此init手势识别代码现在不起作用。

I fix it with add tap gesture recognition delay 0.3 s. 我使用添加点击手势识别延迟0.3 s修复了它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在GestureRecognizer中更改UIView userInteractionEnabled不起作用 - Changing UIView userInteractionEnabled in GestureRecognizer does not work TextView第一次不能正确设置文本格式,但是第二次可以 - TextView does not format text properly the first time, but does the second time 第一次点击按钮操作不起作用 - button action does not work for the first time tapped GestureRecognizer在TableView上不起作用 - GestureRecognizer doesn't work on TableView 为什么检测首次启动或不启动方法不起作用 - why the detect first launch or not method does not work ios 上的音频不能正常工作,只能在第一次工作 - Audio on ios does not work properly, it only works the first time GestureRecognizer和IBOutlet不能一起使用 - GestureRecognizer and IBOutlet don't work together SWRevealViewController-添加GestureRecognizer以查看停止UITableViewCell的工作 - SWRevealViewController - Adding GestureRecognizer to view stops UITableViewCell to work GestureRecognizer无法动态运行/在额外的班级中迅速运行 - GestureRecognizer doesnt work dynamic/in extra class swift 为什么第一个 EditText 视图不能正常工作,但它下面的视图可以正常工作? - Why does the first EditText view not work correctly, but the ones below it do?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM