• 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: Having issues using NSAttribute strings with link Attribute ..
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Having issues using NSAttribute strings with link Attribute ..


  • Subject: Re: Having issues using NSAttribute strings with link Attribute ..
  • From: Ron Fleckner <email@hidden>
  • Date: Mon, 19 Jan 2009 21:59:53 +1100


On 19/01/2009, at 9:33 PM, Arjun SM wrote:

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

Hello Arjun,

I'm not sure, but perhaps your problem is related to _when_ you create the hyperlink. I forget where it was suggested, but I think you need to create it in your window controller's -windowDidLoad delegate method.

Hope that helps.

Ron

_______________________________________________

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


References: 
 >Having issues using NSAttribute strings with link Attribute .. (From: Arjun SM <email@hidden>)

  • Prev by Date: SIGPIPE with sockets
  • Next by Date: Re: Dealing with exceptions in a drawing stack
  • Previous by thread: Having issues using NSAttribute strings with link Attribute ..
  • Next by thread: SIGPIPE with sockets
  • Index(es):
    • Date
    • Thread