2

I understand that NSAttributedString can be used for detecting hyperlinks and setting the styling, etc.

However, I need certain parts of the string to actually "link" to specific actions in the app. For example, consider the text

"this links should open up a native view for [photo 1] and [video 2]"

I do not want photo 1 and video 2 to link to the web. i want a new photoviewcontroller to stack on top of the existing navigation stack.

Can this be achieved with NSAttributed String? If not, what is an easy way to do this? I do not want to use separate UI controls if possible, cause that will be very messy in terms of positioning.

meow
  • 27,476
  • 33
  • 116
  • 177
  • possible duplicate of [NSAttributedString and Links on iOS](http://stackoverflow.com/questions/5772791/nsattributedstring-and-links-on-ios) – jscs Jun 21 '11 at 18:46

1 Answers1

2

You could have your app handle a custom URL scheme. Separately, you would use the JTextView subclass of UITextView to create an attributed string with hyperlinks that use the custom URL scheme.

Alex Reynolds
  • 95,983
  • 54
  • 240
  • 345
  • Works like a charm alex, thanks! The only problem was that we needed to get creative about which navigation controller we wanted to stack the new view ontop of, given that we are no longer in the specific view controller – meow Jun 22 '11 at 21:24