Skip to content

Instantly share code, notes, and snippets.

@mwhuss
Created November 8, 2012 13:35
Show Gist options
  • Select an option

  • Save mwhuss/4038833 to your computer and use it in GitHub Desktop.

Select an option

Save mwhuss/4038833 to your computer and use it in GitHub Desktop.
SVGKit - stroke-dasharray
// - (void)parseAttributes:(NSDictionary *)attributes
if ((value = [attributes objectForKey:@"stroke-dasharray"])) {
if (![value isEqualToString:@"none"] && ![value isEqualToString:@"inherit"] && [value rangeOfString:@"%"].location == NSNotFound) {
NSArray *stringValues = [value componentsSeparatedByString:@","];
NSMutableArray *dashValues = [[NSMutableArray alloc] initWithCapacity:[stringValues count]];
[stringValues enumerateObjectsUsingBlock:^(NSString *stringValue, NSUInteger idx, BOOL *stop) {
[dashValues addObject:[NSNumber numberWithFloat:[stringValue floatValue]]];
}];
_strokeDashArray = [dashValues copy];
[dashValues release];
}
}
// - (CALayer *) autoreleasedLayer
_shapeLayer.lineDashPattern = _strokeDashArray;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment