NSMutableAttributedString attributesAtIndex:effectiveRange: dictionary autoreleased?
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