Created
November 8, 2012 13:35
-
-
Save mwhuss/4038833 to your computer and use it in GitHub Desktop.
SVGKit - stroke-dasharray
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // - (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