• 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
Adding attributes to NSMutableAttributedString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding attributes to NSMutableAttributedString


  • Subject: Adding attributes to NSMutableAttributedString
  • From: Tom Korsgren <email@hidden>
  • Date: Fri, 11 Jun 2010 00:18:03 +0200

Hi!
I'm trying to add some attributes to a NSMutableAttributedString using the code below but only get errors.


NSMutableAttributedString *string = @"aaaaaaaaaaaaaaaaaaaaaaa";
NSRange selectedRange;
selectedRange.location = 1;
selectedRange.length = 2;
NSLog(@" %@ %i %i", string, selectedRange.location, selectedRange.length);

[string addAttribute:NSUnderlineStyleAttributeName
value:[NSNumbernumberWithInt:NSSingleUnderlineStyle]
range:selectedRange];
NSLog(@"End");



In the log the following is printed:
aaaaaaaaaaaaaaaaaaaaaaa 1 2
*** -[NSCFString addAttribute:value:range:]: unrecognized selector sent to instance 0x30b0
*** -[NSCFString addAttribute:value:range:]: unrecognized selector sent to instance 0x30b0



I can't understand what's wrong since the code is nearly identical to examples I found in different documentations.
Thanks! /Tom
_______________________________________________


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: Adding attributes to NSMutableAttributedString
      • From: Graham Cox <email@hidden>
    • Re: Adding attributes to NSMutableAttributedString
      • From: Ken Thomases <email@hidden>
    • Re: Adding attributes to NSMutableAttributedString
      • From: "email@hidden" <email@hidden>
    • Re: Adding attributes to NSMutableAttributedString
      • From: "Stephen J. Butler" <email@hidden>
  • Prev by Date: How can I get the domain name for a user logged into a Mac via Active Directory?
  • Next by Date: Image pinching and double tapping issue.
  • Previous by thread: How can I get the domain name for a user logged into a Mac via Active Directory?
  • Next by thread: Re: Adding attributes to NSMutableAttributedString
  • Index(es):
    • Date
    • Thread