You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to detect the tapped text in CKTextComponent? #246
When I tap on an attributed string of CKTextComponent, the sender is always whole text in component. I only want to know the tapped text of component. Please tell me how to detect it.
Thanks!
@ocrickard
I think it's my bad explain. I had implemented follow issue #74. I can see the text username highlight when I touch on it but the sender is the CKTextComponent with all attributed string (not only the username).
Example:
All text is "abc had do something".
I touch on text "abc" and it's highlight.
The function 'doSomething:' is fired but the sender is the CKTextComponent "abc had do something."
What's wrong with my code in viewAttributes:
{CKComponentActionAttribute(@selector(doSomething:), CKUIControlEventTextViewDidTapText) }
Activity
ocrickard commentedon Jun 11, 2015
You would grab the renderer object off of the CKTextComponentView, and then ask for the text checking result at the point the user touched (https://github.com/facebook/componentkit/blob/master/ComponentTextKit/TextKit/CKTextKitRenderer%2BTextChecking.h#L27).
Also, please see issue #74
tranngoclinh88 commentedon Jun 11, 2015
@ocrickard
I think it's my bad explain. I had implemented follow issue #74. I can see the text username highlight when I touch on it but the sender is the CKTextComponent with all attributed string (not only the username).
Example:
What's wrong with my code in viewAttributes:
{CKComponentActionAttribute(@selector(doSomething:), CKUIControlEventTextViewDidTapText) }
How can I get the touched text "abc"?
ocrickard commentedon Jun 12, 2015
You would change your
doSomething:method to look something like this instead:tranngoclinh88 commentedon Jun 15, 2015
Thank @ocrickard.