Having issues using NSAttribute strings with link Attribute ..
Having issues using NSAttribute strings with link Attribute ..
- Subject: Having issues using NSAttribute strings with link Attribute ..
- From: Arjun SM <email@hidden>
- Date: Mon, 19 Jan 2009 16:03:03 +0530
Hi all,
i am novice in cocoa so please bear with me ..
I have created an URL link in one my custom applications About box as
described below
NSMutableAttributedString *string = [[NSMutableAttributedString alloc]
initWithString:@"Cocoa Inc"];
NSRange selectedRange = NSMakeRange(0, 10);
NSURL *linkURL = [NSURL URLWithString:@"http://www.apple.com/"];
[string beginEditing];
[string addAttribute:NSLinkAttributeName
value:linkURL
range:selectedRange];
[string addAttribute:NSForegroundColorAttributeName
value:[NSColor blueColor]
range:selectedRange];
[string addAttribute:NSUnderlineStyleAttributeName
value:[NSNumber numberWithInt:NSSingleUnderlineStyle]
range:selectedRange];
[string endEditing];
I have binded this Attributed string to a Label. I was able to get an URL
link in my About Box, clicking on it will open the browser. But i am facing
a problem with this,
The first time i open the About Box screen i am unable to click on the link.
!!! I have to click on the frame of the Label Once , then the font of the
link will change and mouse pointer will reform to a hand(clickable)
pointer. !!
How do i fix this problem???
thanks in advance for all the help.
~Arjun
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden