On 10 Jun 2010, at 23:18, Tom Korsgren wrote:
> Hi!
> I'm trying to add some attributes to a NSMutableAttributedString using the
> code below but only get errors.
>
> NSMutableAttributedString *string = @"aaaaaaaaaaaaaaaaaaaaaaa";
This creates an NSString instance, not an NSMutableAttributedString.
Regards
Jonathan Mitchell
Developer
Mugginsoft LLP
http://www.mugginsoft.com
> 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 (Cocoa-dev@lists.apple.com)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/jonathan%40mugginsoft.com
>
> This email sent to jonat...@mugginsoft.com
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com