• 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
After inserting link into text, link continues as user types
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

After inserting link into text, link continues as user types


  • Subject: After inserting link into text, link continues as user types
  • From: Philip Dow <email@hidden>
  • Date: Mon, 20 Feb 2006 21:05:14 +0100

Hiya, been a while.

I am using an attributed string to insert a link into a text view. Under 10.4, the link inserts fine, and any text the user types after the link, space or not, does not take on the link attribute. Under 10.3.9, however, whatever the user types includes the link. If the user first types a space, the space is not underlined until a character is added, at which point all the text after the link takes on the link attribute. Is there a way around this short of adding a space without the link attribute to an attributed string which otherwise includes the link, all before inserting the string?

Huh, déjà vu. Have I asked this before? Code follows...

NSURL *fileURL = [[NSURL alloc] initWithString:urlLoc];
NSAttributedString *preparedText = [[NSAttributedString alloc] initWithString:linkedText attributes:[NSDictionary dictionaryWithObject:fileURL forKey:NSLinkAttributeName]];
[self insertText:preparedText];


// self here because the code is used inside a subclass of nstextview, consider all error checking and memory management done.

-Phil _______________________________________________
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: After inserting link into text, link continues as user types
      • From: Martin Wierschin <email@hidden>
  • Prev by Date: Re: Cocoa application and consol out put
  • Next by Date: Re: How to specify document extension programmatically
  • Previous by thread: Re: Cocoa application and consol out put
  • Next by thread: Re: After inserting link into text, link continues as user types
  • Index(es):
    • Date
    • Thread