3

I am writing a Twitter type client. I want stuff like @ and # clickable. When I click on it, I want it to do some sort of IBAction. I found this for OSX:

http://flyosity.com/mac-os-x/clickable-tweet-links-hashtags-usernames-in-a-custom-nstextview.php

This is along the lines of what I want to accomplish. Anything for iOS that is of this caliber?

Sheehan Alam
  • 60,111
  • 124
  • 355
  • 556

4 Answers4

4

The best dropin solution I've found was this: https://github.com/SebastienThiebaud/STTweetLabel Clean and simple.

MacD
  • 783
  • 7
  • 23
3

You can make any properly formatted URLs appear as blue underlined active links in a UITextView with the following code (in say viewDidLoad)

self.myTextView.editable = NO;
self.myTextView.dataDetectorTypes = UIDataDetectorTypeLink;

Search for "Technical Q&A QA1495" in Xcode's Documentation and API Reference.

Dalee Davis
  • 981
  • 8
  • 19
howdyworld
  • 41
  • 6
1

Just off the top of my head, I guess you could achieve it by using a UIWebView to display the content (which you have linkified, as per the "2: Finding The Interesting Parts" part of the blog post).

If you then prefix the hashtag links with a custom url scheme, like myappopenshashtags://, and register that url scheme for your app, you should be able to open your hashtags in whatever way you please.

uvesten
  • 3,365
  • 2
  • 27
  • 40
0

Look at this page http://furbo.org/2008/10/07/fancy-uilabels/

FoJjen
  • 774
  • 1
  • 6
  • 14