J'essaie d'utiliser CGPathApply pour parcourir chaque CGPathElement dans un objet CGPathRef (principalement pour écrire un moyen personnalisé de persister des données CGPath). Le problème est, chaque fois qu'il arrive à l'appel à CGPathApply, mon programme se bloque sans aucune information du tout. Je soupçonne que le problème est dans la fonction applicateur, mais je ne peux pas le dire. Voici un exemple de mon code:Comment utiliser CGPathApply correctement
- (IBAction) processPath:(id)sender {
NSMutableArray *pathElements = [NSMutableArray arrayWithCapacity:1];
// This contains an array of paths, drawn to this current view
CFMutableArrayRef existingPaths = displayingView.pathArray;
CFIndex pathCount = CFArrayGetCount(existingPaths);
for(int i=0; i < pathCount; i++) {
CGMutablePathRef pRef = (CGMutablePathRef) CFArrayGetValueAtIndex(existingPaths, i);
CGPathApply(pRef, pathElements, processPathElement);
}
}
void processPathElement(void* info, const CGPathElement* element) {
NSLog(@"Type: %@ || Point: %@", element->type, element->points);
}
Des idées sur la raison pour laquelle l'appel à cette méthode d'application semble se bloquer? Toute aide est grandement appréciée.
http://www.mlsite.net/blog/?p=1312 –
Jetez un oeil ici, c'est un excellent article sur comment utiliser correctement CGPathApply: http://oleb.net/blog/2012/12/access-pretty-printing-cgpath-elements / –