Re: NSTextStorage: efficient way to find a specific attribute?
Re: NSTextStorage: efficient way to find a specific attribute?
- Subject: Re: NSTextStorage: efficient way to find a specific attribute?
- From: Marcel Weiher <email@hidden>
- Date: Mon, 12 May 2003 00:29:14 +0200
Hi Just,
the NSAttributedString implementation is opaque, so we don't actually
know what will be efficient and what not.
However, -attribute:atIndex:effectiveRange: seems to be your ticket.
Start this with index 0. It will return non-nil if the attribute
exists at index 0, so you are done in that case.
If the attribute does *not* exist at that index, effectiveRange will be
filled with the range for which the attribute does *not* exist, so
effeciveRange.location + effectiveRange.length should point you to the
first character where the attribute *does* exist.
I think that is what you were looking for, right?
Regards,
Marcel
On Sunday, May 11, 2003, at 10:40 Uhr, Just van Rossum wrote:
Is there a way to quickly find out the character index of the first
occurance of a specific (custom) attribute in an
NSTextStorage/NSAttributedString? I've been looking all over, but no
luck so far.
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.