简体   繁体   English

UITextInput - 如何让它添加标准选择手势识别器?

[英]UITextInput - How to get it to add standard selection gesture recognizers?

Is there a way to persuade iOS to attach the standard gesture recognizers to a custom view that implements UITextInput? 有没有办法说服iOS将标准手势识别器附加到实现UITextInput的自定义视图?

I have implemented all methods of UITextInput, I am drawing selection, the cursor and marking myself. 我已经实现了UITextInput的所有方法,我正在绘制选择,光标和标记自己。 I found that long-pressing on marked text shows the rectangular system loupe. 我发现长按标记的文字显示矩形系统放大镜。 This tells me that there are situations when the touch handling IS provided by the system. 这告诉我有些情况是系统提供触摸处理。

Is there a method to get the standard selection gestures also working without having to add a bunch of touch handling code and drawing the loupes yourself? 是否有一种方法可以使标准选择手势也能工作,而无需添加一堆触摸处理代码并自己绘制放大镜?

Sadly, no. 可悲的是没有。 You have to implement all of that yourself. 你必须自己实现所有这些。 I spent a great deal of time in the Advanced Text lab while at WWDC, bugging the guys who wrote most of Core Text. 我在WWDC期间花了很多时间在高级文本实验室,花了大量写入Core Text的人。 There are some odd bits where system functionality shines though, if you use a label to do some of the drawing. 如果你使用标签来做一些绘图,那么系统功能会有一些奇怪的位置。 But in the current SDK, we are out of luck. 但在目前的SDK中,我们运气不好。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM