• 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: NSMutableAttributedString's setBaseWritingDirection problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableAttributedString's setBaseWritingDirection problem


  • Subject: Re: NSMutableAttributedString's setBaseWritingDirection problem
  • From: Dmitry Markman <email@hidden>
  • Date: Sun, 15 Jun 2008 18:01:40 -0400

indeed

thanks a lot
it works now



On Jun 15, 2008, at 5:13 PM, Ken Thomases wrote:


On Jun 15, 2008, at 3:57 PM, Dmitry Markman wrote:

Hi, all

I have a problem with the NSMutableAttributedString's setBaseWritingDirection method

here is a code

NSMutableAttributedString *attrString = [[[NSAttributedString alloc] initWithString:textString attributes:stringAttributes] autorelease];

The above creates an immutable NSAttributedString. The pointer to that is stored in a variable of type NSMutableAttributedString*, but that doesn't make it so. Replace the use of "NSAttributedString" in the above with "NSMutableAttributedString" to do the proper thing.



NSRange attrStringRange = NSMakeRange(0,[[attrString string] length]);
@try {
[attrString setBaseWritingDirection:NSWritingDirectionNatural
range:attrStringRange];
} @catch (NSException *exception) {
NSLog(@"main: Caught %@: %@", [exception name], [exception reason]);
}
I'm getting exception
2008-06-15 16:39:06.465 Gateways[14812:10b] *** - [NSConcreteAttributedString setBaseWritingDirection:range:]: unrecognized selector sent to instance 0x10248ab0


NSLog output is

2008-06-15 16:41:48.676 Gateways[14812:10b] main: Caught NSInvalidArgumentException: *** -[NSConcreteAttributedString setBaseWritingDirection:range:]: unrecognized selector sent to instance 0x10248ab0

This exception sort of gives you the hint, if you know what to look for. The object is of the concrete class NSConcreateAttributedString, which doesn't indicate that it's mutable, so you can guess that it isn't.


Cheers,
Ken

Dmitry Markman

_______________________________________________

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: 
 >NSMutableAttributedString's setBaseWritingDirection problem (From: Dmitry Markman <email@hidden>)
 >Re: NSMutableAttributedString's setBaseWritingDirection problem (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: When is a document moved or renamed?
  • Next by Date: How can an object know when another object has gone away?
  • Previous by thread: Re: NSMutableAttributedString's setBaseWritingDirection problem
  • Next by thread: How can an object know when another object has gone away?
  • Index(es):
    • Date
    • Thread