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

Re: Adding attributes to NSMutableAttributedString


  • Subject: Re: Adding attributes to NSMutableAttributedString
  • From: Ken Thomases <email@hidden>
  • Date: Mon, 14 Jun 2010 14:08:39 -0500

On Jun 10, 2010, at 5:18 PM, Tom Korsgren wrote:

> I'm trying to add some attributes to a NSMutableAttributedString using the code below but only get errors.
>
> 	NSMutableAttributedString *string = @"aaaaaaaaaaaaaaaaaaaaaaa";

This line is wrong.  You are taking a NSString literal object pointer and assigning it to a pointer to an NSMutableAttributedString.  The compiler should be giving you a warning.

First, NSString is not mutable.  Second, it's not an attributed string.


> 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

NSCFString is a concrete implementation class within the NSString class cluster.  Its appearance in the above messages is part of the clue as to the problem.  It's not any variety, let alone a mutable variety, of attributed string.

Regards,
Ken

_______________________________________________

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: 
 >Adding attributes to NSMutableAttributedString (From: Tom Korsgren <email@hidden>)

  • Prev by Date: Re: CocoaEcho
  • Next by Date: Re: CocoaEcho
  • Previous by thread: Re: Adding attributes to NSMutableAttributedString
  • Next by thread: Re: Adding attributes to NSMutableAttributedString
  • Index(es):
    • Date
    • Thread