Re: Find color's change in a NSString (attributed)
Re: Find color's change in a NSString (attributed)
- Subject: Re: Find color's change in a NSString (attributed)
- From: Andrea Salomoni <email@hidden>
- Date: Mon, 20 Feb 2006 18:12:55 +0100
Thank you for reply.
I found some problems with this code:
isColsedTo: method returns me a warning and about myColor in this
case I can find only a specific color?
Or have I to alloc and initialize a new instance of NSColor?
Thabk you for your kind help!
Andrea
Il giorno 20/feb/06, alle ore 17:36, Stephane Sudre ha scritto:
On 20 févr. 06, at 17:18, Andrea Salomoni wrote:
Hi to all,
I have a text with some colors and I need to parse the text and
know the words with the color and change it.
I already parsed the text succesfully , but cannot find any
documentation about searching the color's change in a text.
Anyone can help me?
Hmm, maybe this can work:
tIndex=0;
tLength=[tAttributedString length];
while (tIndex<tLength)
{
tRangeLimit=NSMakeRange(tIndex,tLength-tIndex);
tAttributes=[tAttributedString attributesAtIndex:tIndex
longestEffectiveRange:&tRangeOut inRange:tRangeLimit];
if (tAttributes!=nil)
{
NSColor * tForeColor;
tForeColor=[tAttributes
objectForKey:NSForegroundColorAttributeName];
if ([tForeColor isClosedTo:myColor]==YES) // isClosedTo is a
method I use in a category of NSColor
{
// Do my stuff
}
tIndex+=tRangeOut.length;
}
else
{
break;
}
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden