• 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: Find color's change in a NSString (attributed)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Find color's change in a NSString (attributed)
      • From: Stephane Sudre <email@hidden>
References: 
 >Find color's change in a NSString (attributed) (From: Andrea Salomoni <email@hidden>)
 >Re: Find color's change in a NSString (attributed) (From: Stephane Sudre <email@hidden>)

  • Prev by Date: Re: Find color's change in a NSString (attributed)
  • Next by Date: Re: Universal Binary build problem
  • Previous by thread: Re: Find color's change in a NSString (attributed)
  • Next by thread: Re: Find color's change in a NSString (attributed)
  • Index(es):
    • Date
    • Thread