Permalink
Browse files

Merge pull request #1 from Me1000/master

Proper shadow stuff, i.e. REAL JSON support...
  • Loading branch information...
2 parents 430257a + 011ee25 commit 3eaff6f2514fc20b20d22f5e9c25ad1d31557d3c @Me1000 Me1000 committed Jun 18, 2012
Showing with 20 additions and 5 deletions.
  1. +15 −2 JWStyleSheet/JWSheetParser.m
  2. +5 −3 JWStyleSheet/testjson.json
@@ -182,8 +182,21 @@ - (NSDictionary*)buildTextAttributes:(NSDictionary*)val;
UIFont *font = [UIFont fontWithName:fontName size:fontSize];
UIColor *fontColor = [self parseColor:[val objectForKey:@"color"]];
- UIColor *shadowColor = [self parseColor:[val objectForKey:@"shadow-color"]];
- NSValue *shadowOffset = [NSValue valueWithUIOffset:UIOffsetFromString([val objectForKey:@"shadow-offset"])];
+ UIColor *shadowColor;
+ NSValue *shadowOffset;
+ NSDictionary *shadow = [val objectForKey:@"shadow"];
+
+ if (shadow != nil)
+ {
+ shadowColor = [self parseColor:[shadow objectForKey:@"color"]];
+ shadowOffset = [NSValue valueWithUIOffset:UIOffsetMake([[shadow objectForKey:@"x"] doubleValue], [[shadow objectForKey:@"y"] doubleValue])];
+ }
+ else
+ {
+ shadowColor = [self parseColor:[val objectForKey:@"shadow-color"]];
+ shadowOffset = [NSValue valueWithUIOffset:UIOffsetFromString([val objectForKey:@"shadow-offset"])];
+ }
+
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
if (font)
@@ -40,9 +40,11 @@
{
"font" : "Helvetica",
"size" : 10,
- "color" : "FF00FF",
- "shadow-color" : "0000FF",
- "shadow-offset" : "{1, -1}",
+ "shadow": {
+ "color":"0000FF",
+ "x": 1,
+ "y": -1
+ }
}
}
}

0 comments on commit 3eaff6f

Please sign in to comment.