Enchilada Enchilada - 9 days ago 9
Objective-C Question

Make an URL in an NSTextFieldCell clickable

There are two parts to this question:

(1) How can I detect URLs in a given text?

(2) How can I make clickable a part of the text in a text field cell (in a table view)? I would like URLs, when clicked upon, to open in the default web browser.

Answer

For making URLs clickable please take a look at this guide from Apple: Embedding Hyperlinks in NSTextField and NSTextView

For the first part, are you married to using an NSTextField? The reason is that NSTextView provides this automatically (it is just a checkbox in IB). Otherwise, have a look at this answer on StackOverflow regarding the Latent Semantic Mapping Framework.

I have not used it so I am afraid that I cannot offer any suggestions on it.

Comments