• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Programatically create URLs in NSTextView or ??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programatically create URLs in NSTextView or ??


  • Subject: Re: Programatically create URLs in NSTextView or ??
  • From: Douglas Davidson <email@hidden>
  • Date: Tue, 6 Sep 2005 11:09:50 -0700


On Sep 5, 2005, at 9:20 PM, RameshPVK wrote:

You can do this by setting the attributes to the attributed string. You can find the list of attributes in the NSAttributedString Additions in Appkit. And now coming to set a text as URL you need to do the following :
1) get the range of text
2) to that range set the following properties : NSForegroundColorAttributeName and NSLinkAttributeName to set the link object.
3) The hand cursor for the URL can be achieved by implementing the following method



It should suffice to set NSLinkAttributeName on the range in question. An NSTextView has a set of linkAttributes that are automatically applied to links; by default these include coloring, underlining, and the appropriate cursor. The value of the attribute may be an NSString or an NSURL, and the text view will automatically open it when clicked on; alternatively, you may use the delegate method to be notified of clicks, and make the value of the attribute whatever you choose.


Douglas Davidson

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Programatically create URLs in NSTextView or ??
      • From: email@hidden (Stefan Haller)
References: 
 >Re: Programatically create URLs in NSTextView or ?? (From: RameshPVK <email@hidden>)

  • Prev by Date: Re: NSTextView - setSelectedRange hides caret?
  • Next by Date: Padding around a borderless NSTextField
  • Previous by thread: Re: Programatically create URLs in NSTextView or ??
  • Next by thread: Re: Programatically create URLs in NSTextView or ??
  • Index(es):
    • Date
    • Thread