There are two parts to this question:
(1) How to determine the URLs in a given text?
(2) How to make an interactive part of the text in a cell in a text field (as a table)? I would like the URLs to open in the default web browser when I click on them.
To make URLs interactive, check out this Apple tutorial: Embed Hyperlinks in NSTextField and NSTextView
In the first part, are you married to using NSTextField? The reason is that NSTextView provides this automatically (this is just a checkbox in IB). Otherwise, check fooobar.com/questions/894888 / ... .
, , .
this, ,
NSMutableAttributedString * str = [[NSMutableAttributedString alloc] initWithString:@"Google"]; [str addAttribute: NSLinkAttributeName value: @"http://www.google.com" range: NSMakeRange(0, str.length)]; yourTextView.attributedText = str;
Source: https://habr.com/ru/post/1792384/More articles:I use JSP with NetBeans and I get the following error - javaPartition names from NSFetchedResultsController do not match managed object values - iosЧто такое короткая история системы входа в систему Ruby on Rails? - ruby-on-railsWhat event is fired when an asp.net page loads in a browser - c #What are the user mappings with the kernel? - mappingHow to get non-dynamic characters in GCC backtrace? - c ++get_class_vars () does not show the variable, but the ex_xists () property, running in the same class, returns true - objectIs extending the FCL system namespace really bad practice? - namespacesHow to detect leaks of UIKit objects? - iosWhy Ruby on Rails' User.create! (: Email => 'ha',: identifier => 'foo') does not work? - ruby-on-railsAll Articles