Sie nicht ur Weg überhaupt in NSString umgewandelt werden müssen.
Sie können den Pfad für Text wie folgt erstellen:
CTFontRef font = CTFontCreateWithName(CFSTR("Helvetica-Bold"), 72.0f, NULL);
NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
(id)font, kCTFontAttributeName,
nil];
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:@"Hello World!"
attributes:attrs];
CTLineRef line = CTLineCreateWithAttributedString((CFAttributedStringRef)attrString);
CFArrayRef runArray = CTLineGetGlyphRuns(line);
// for each RUN
for (CFIndex runIndex = 0; runIndex < CFArrayGetCount(runArray); runIndex++)
{
// Get FONT for this run
CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runArray, runIndex);
CTFontRef runFont = CFDictionaryGetValue(CTRunGetAttributes(run), kCTFontAttributeName);
// for each GLYPH in run
for (CFIndex runGlyphIndex = 0; runGlyphIndex < CTRunGetGlyphCount(run); runGlyphIndex++)
{
// get Glyph & Glyph-data
CFRange thisGlyphRange = CFRangeMake(runGlyphIndex, 1);
CGGlyph glyph;
CGPoint position;
CTRunGetGlyphs(run, thisGlyphRange, &glyph);
CTRunGetPositions(run, thisGlyphRange, &position);
// Get PATH of outline
{
CGPathRef letter = CTFontCreatePathForGlyph(runFont, glyph, NULL);
CGAffineTransform t = CGAffineTransformMakeTranslation(position.x, position.y);
CGPathAddPath(letters, &t, letter);
CGPathRelease(letter);
}
}
}
CFRelease(line);
Dies ist, wie Sie einen Pfad erstellen, für Codebeispiel bitte this link beziehen. Dieser Code ist ein Teil dieses Beispielprojekts. Hoffe, das hilft dir
Warum willst du Pfad zu String konvertieren ?? U kann die Aufgabe direkt auf dem zurückgegebenen Pfad animieren :) – DivineDesert
ich werde nicht konvertieren suchen, um den Pfad einer bestimmten Zeichenfolge mein Objekt zu bekommen, ist eine Anwendung für meine Projekt Schule wie Brief Schule oder ich writeword –
zu erklären, suchen in dieser App http://letterschool.com/ Ich möchte das gleiche denken, wie sie es tun, um den Brief zu schreiben "Entschuldigung für mein Bett Englisch" –