• 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
NSMutableAttributedString attributesAtIndex:effectiveRange: dictionary autoreleased?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSMutableAttributedString attributesAtIndex:effectiveRange: dictionary autoreleased?


  • Subject: NSMutableAttributedString attributesAtIndex:effectiveRange: dictionary autoreleased?
  • From: Eyal Redler <email@hidden>
  • Date: Sat, 14 Aug 2010 14:56:33 +0300

Hi,

I can't find any mention of if in the documentation but I need to know: how safe is it to use the dictionary returned from "attributesAtIndex:effectiveRange" after I've made changes to the attributed string? More specifically, I'm worried that maybe what I'm getting (at least sometimes) is not a copy of the dictionary at that point but the actual mutable dictionary off the string data structure and that it may be changed when I'm making changes to the attributed string.

For example:

NSDictionary* myAttributes;

[myMutableAttributedString addAttribute:@"my attribute" value:[NSNumber numberWithInt:10] range:NSMakeRange(0,10)];

myAttributes=[myMutableAttributedString attributesAtIndex:4 effectiveRange:NULL];

[myMutableAttributedString addAttribute:@"my attribute" value:[NSNumber numberWithInt:20] range:NSMakeRange(0,10)];

anAttribute=[myAttributes attributesAtIndex:4 effectiveRange:NULL];

Is anAttribute guaranteed to be equal to 10?

TIA


Eyal Redler
------------------------------------------------------------------------------------------------
"If Uri Geller bends spoons with divine powers, then he's doing it the hard way."
--James Randi
www.eyalredler.com


_______________________________________________

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

  • Follow-Ups:
    • Re: NSMutableAttributedString attributesAtIndex:effectiveRange: dictionary autoreleased?
      • From: Michael Ash <email@hidden>
  • Prev by Date: OCTest running the same test against multiple classes
  • Next by Date: Re: Recursive file remove
  • Previous by thread: Re: OCTest running the same test against multiple classes
  • Next by thread: Re: NSMutableAttributedString attributesAtIndex:effectiveRange: dictionary autoreleased?
  • Index(es):
    • Date
    • Thread