Re: how to print attributed strings to output (using NSLog? or otherwise)
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:20:19 +0000
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