UITextView or UIWebView with common link-like words

I watched the Twitter app for the iPhone and was puzzled.

First of all, there are normal words that look like links inside.

Secondly, when I touch on these similar words, the text view (or possibly the web view) goes to the corresponding part below (yes, it does not open Safari, it just jumps to the text inside this text / web page view)

Now I want to implement the same effects.

  • Should I base my implementation on what? UITextView or UIWebView?
  • How to make normal words look like links?
  • How to make these smooth jumps in such text / web presentations?

Thanks in advance.

alt textalt text

+1
source share
3 answers

Have you considered the three20 library ? In one of my TTCatalog there are examples of displaying exactly what you are looking for. What's good about the project is that you can use HTML for styling - it will know to convert the anchor, for example, to a button click.

+1
source

Include the local html file in your project

For instance:

 <html> <head> <body> <p>By tapping "Sign up" above, you are agreeing to the <a id="TOS-link" href="#TOS">Terms of Service</a> and <a id="PP-link" href="#PP">Privacy Policy</a></p> </body> </head> </html> 

Finally, display it in a UIWebView

+2
source

You can use an HTML file with anchor tags in it. Add it to the Resources folder as .htm and upload it to webview. When you click on these links, it will move the corresponding related part on the page.

+1
source

Source: https://habr.com/ru/post/1334159/


All Articles