Cocoa color
8 juli 2008 - 18:39   
geplaatst door: stijnschoor
Hallo

Kijk hier even naar

[Text setTextColor:[NSColor blueColor] range:html];

Ik heb een NSTextView waar ik ik alle html tags gekleurd wil hebben, dit doe ik door de range html te verbinden met de tag html. Nu is het probleem dat als ik twee keer een html tag invoer dat alleen de eerste gekleurd wordt. Weet iemand wat ik moet doen?

"What's in a name that we call a mac"
Shakespeare
Cocoa color
9 juli 2008 - 15:15    reactie #1
geplaatst door: stijnschoor
Sorry voor die wagize post. ik zal het anders uitleggen

int badRange;
NSScanner *scanner = [NSScanner scannerWithString:scanPath];
[scanner scanUpToString:@"man" intoString:nil];
badRange = [scanner scanLocation];
NSRange banRan = NSMakeRange(badRange, 0);

if(banRan.location == NSNotFound)
{
NSLog(@"good");
}

De bedoeling is dat het bestand wordt gecontroleerd op het woord man, alleen als ik op de knop druk die daar is toegewezen gebeurd er niks. Weet iemand hoe het moet?

"What's in a name that we call a mac"
Shakespeare
Cocoa color
15 juli 2008 - 09:47    reactie #2
geplaatst door: TGV
Je bent nog steeds wazig. Hoezo gebeurt (met een -t, overigens) er niks? Bedoel je dat de tekst "man" wel in scanPath (ietwat gekke naam) staat, maar dat scanLocation NSNotFound teruggeeft? Als ik de beschrijving van scanLocation lees, kan dat wel kloppen:

If the search string (stopString) isn't present in the scanner's source string, the remainder of the source string is put into stringValue, the receiver’s scanLocation is advanced to the end of the source string, and the method returns YES.

Cocoa color
20 juli 2008 - 18:14    reactie #3
geplaatst door: stijnschoor
Sorry voor de spelfout

het is al opgelost. Aangezien het nog al een lang verhaal is, zal ik het uitleggen als iemand dat wil

"What's in a name that we call a mac"
Shakespeare