After inserting link into text, link continues as user types
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