Sono un principiante iOS. Come rendere un UIBezierPath che segue un alfabeto dire "B". L'obiettivo è tracciare i tocchi lungo questo percorso.iOS UIBezierPath che segue la forma di un font
Grazie in anticipo.
Sono un principiante iOS. Come rendere un UIBezierPath che segue un alfabeto dire "B". L'obiettivo è tracciare i tocchi lungo questo percorso.iOS UIBezierPath che segue la forma di un font
Grazie in anticipo.
Per i disegni in Quartz2D uso un'app OSX denominata PaintCode (http://www.paintcodeapp.com/). È fondamentalmente un'app di disegno vettoriale che genera il codice quarzo del disegno che fai. In realtà è davvero fantastico. C'è una app simile chiamata Opacity ma non l'ho ancora provata.
Con tali app è possibile avere una B sullo sfondo come guida e disegnare su di esso il proprio BezierPath. Una volta che hai finito, copia il codice generato e incollalo nel tuo progetto.
Spero che aiuti.
BTW, è possibile scaricare una versione demo. Forse questo potrebbe essere sufficiente per il tuo problema. – Marcal
CoreText.framework fornisce i metodi per ottenere il percorso di parola
vedere http://www.codeproject.com/Articles/109729/Low-level-text-rendering
esempio di codice creato da Ole Begemann. Scusa, ho dimenticato l'url di download per la demo denominata AnimatedPath.
CGMutablePathRef letters = CGPathCreateMutable();
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);
UIBezierPath *path = [UIBezierPath bezierPath];
[path moveToPoint:CGPointZero];
[path appendPath:[UIBezierPath bezierPathWithCGPath:letters]];
CGPathRelease(letters);
CFRelease(font);
sostituire “Ciao Mondo!” Con "La Parola è necessario".
Si prega di notare che è necessario inserire i punti utili di una risposta qui, su questo sito, o il tuo post rischia di essere cancellato come ["Non è una risposta"] (http://meta.stackexchange.com/q/8259). Puoi ancora includere il link se lo desideri, ma solo come un "riferimento". La risposta dovrebbe essere autonoma senza bisogno del collegamento. –
Grazie per il tuo promemoria – nova
Hai trovato una soluzione? –
Ciao .. Avevi qualche soluzione? –