I want to allow my users to include a tappable element in a paragraph of text they've written inside my app. Similar behaviour to this is a twitter client which has tappable links and mentions as part of the text. I presume the best way to do this would be to use an NSAttributedString. I'm unsure how I could get some of the text to be tappable though. How could I do this?
Asked
Active
Viewed 814 times
0
-
Do you want to link to a website or to another part in your app? – HAS Apr 28 '13 at 18:11
1 Answers
0
you can use a UIWebView and pass in an html string,
<p>Some text going here <button> clickable text </button> more text <\p>
and there is a delegate method for when a uiweb view sends out some request for clicking the button
you can record the location of the text you want to click and then manually test if the user taps in that area
you can pragmatically create custom buttons as you see fit and place them in the places of the words
best way to do it in general is the uiwebview which html already has text formatting , but i don't know how complex your app is so that might not be an option

A'sa Dickens
- 2,045
- 1
- 16
- 21
-
The problem with UIWebView is that the user will be able to edit it in the same area. – Andrew Apr 28 '13 at 19:11