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

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

  • Follow-Ups:
    • Re: Having issues using NSAttribute strings with link Attribute ..
      • From: Ron Fleckner <email@hidden>
  • Prev by Date: Re: Dealing with exceptions in a drawing stack
  • Next by Date: SIGPIPE with sockets
  • Previous by thread: Re: Memory allocation issues with NSObject and NSString
  • Next by thread: Re: Having issues using NSAttribute strings with link Attribute ..
  • Index(es):
    • Date
    • Thread