开发者

Make an URL in an NSTextFieldCell clickable

开发者 https://www.devze.com 2023-02-10 22:29 出处:网络
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 vi开发者_开发技巧ew)? I would like U

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 vi开发者_开发技巧ew)? I would like URLs, when clicked upon, to open in the default web browser.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消