• 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: how to print attributed strings to output (using NSLog? or otherwise)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to print attributed strings to output (using NSLog? or otherwise)


  • Subject: Re: how to print attributed strings to output (using NSLog? or otherwise)
  • From: "Chase" <email@hidden>
  • Date: Fri, 20 Jul 2007 21:28:11 +0000


haha. i just tried going back to:

NSLog(@"%@", myattributedstring);

... and it did **not** throw an exception. instead it looked like the same output as:

NSLog(@"%@", [myattributedstring description]);

... which is:

2007-07-20 16:24:12.711 testapp[707] ABCDEFGHIJKLMNOP{
NSColor = NSCalibratedRGBColorSpace 1 0 0 1; NSFont = "Times-Roman 14.00 pt. P [] (0x003a4fd0) fobj=0x003a4990, spc=3.50"; }



weird. not sure what's up with that.

- chase



On July 20, 2007, Chase wrote:


to clarify...

before, i was doing:

NSLog(@"%@", myattributedstring);

... which was throwing an exception.

then i changed it to:

NSLog(@"%@", [myattributedstring string]);

... which runs and prints the string, but not with attributes.


- chase




On July 20, 2007, Clark Cox wrote:

On 7/20/07, John Stiles <email@hidden> wrote:
On Jul 20, 2007, at 1:25 PM, Douglas Davidson wrote:

>
> On Jul 20, 2007, at 1:19 PM, Andrew Farmer wrote:
>
>> On 20 Jul 07, at 11:26, Chase wrote:
>>> if I create an attributed string and set its color to red, how
>>> can i print this into the output pane in xcode?
>>
>> If you're trying to ask whether you can print it in red, the
>> answer is "no". The XCode output pane does not support formatting.
>
> On the other hand, if you have an attributed string and want to log
> both the text and the attributes for debugging purposes,
> NSAttributedString does have a (more or less intelligible) -
> description method.  You can NSLog(@"the attributed string is %@",
> myAttributedString) if you like, and you will get a plain-text
> description of the various ranges of text and their attributes.
>
> Douglas Davidson

Except the OP makes it seem like this was throwing an exception. :|

From the exception, it appears that they were trying to pass the
NSAttributedString as the *first* parameter of NSLog(), which, of
course, must be an NSString.

--
Clark S. Cox III
email@hidden
_______________________________________________

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


_______________________________________________

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


_______________________________________________

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


  • Prev by Date: Re: how to print attributed strings to output (using NSLog? or otherwise)
  • Next by Date: Re: how to print attributed strings to output (using NSLog? or otherwise)
  • Previous by thread: Re: how to print attributed strings to output (using NSLog? or otherwise)
  • Next by thread: Re: NSArrayController content array vs arrangedObject
  • Index(es):
    • Date
    • Thread