有没有办法创建自定义UIDataDetectorTypes? [英] Is there a way to create custom UIDataDetectorTypes?
问题描述
我要做的是创建工具提示功能,以便可以点击我的教学应用程序中的某些单词并弹出定义。对于弹出式部分,我计划使用AFInformationView中的代码,该代码在iPhone上提供气泡。
What I am trying to do is create tooltip functionality so that certain words in my instructional app can be tapped and the definition pops up. For the popup part I plan on using code from "AFInformationView" which provides bubbles on the iPhone.
我正在努力解决的问题是如何关联特定单词的位置随着泡沫。目前,我在自定义UITableCell上的UILabel上有文本。因为我用以下方法计算行高:
The part I'm struggling with is how to associate A particular word's location with the bubble. Currently I have the text on a UILabel that is on a custom UITableCell. Since I calculate the row height on the fly with:
[textToUse sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:CGSizeMake(stop-start, 500)];
我不确定具体单词的坐标是什么。我想如果我创建了一个可能是修复的自定义DataDetectorType。
I'm not sure what the coordinates for a specific word will be. I was thinking that if I created a custom DataDetectorType that could be the fix.
如果有人知道怎么做或有任何其他想法我会很高兴听到他们。
If anyone knows how to do this or has any other ideas I would be happy to hear them.
谢谢,
Andrew
推荐答案
我没有创建自定义的UIDataDetectorTypes,但Craig Hockenberry用他的TwitterrificTouch做了类似的事情。
I didn't create a custom UIDataDetectorTypes but Craig Hockenberry did something like it with his TwitterrificTouch.
他使用正则表达式来检测链接和其他内容。我提供了我的关键字,然后它们变得可以点击。他将按钮放在底层标签的匹配文本之上。你可以google很多关于把透明按钮放在最上面的帖子,但是Craig的代码是我能找到的唯一的例子/工作代码。
He uses regular expressions to detect links and other things. I provide it with my keywords and then they become tappable. He places buttons on top of the matching text from the underlying labels. You can google a lot of posts that talk about "putting transparent buttons on top" of various things but Craig's code is the only example/working code I could find.
这里是链接:
http://furbo.org/2008/10 / 07 / fancy-uilabels /
这篇关于有没有办法创建自定义UIDataDetectorTypes?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!