Skip to content

Commit

Permalink
added changes by Javier
Browse files Browse the repository at this point in the history
  • Loading branch information
rborn committed Feb 24, 2012
1 parent 057fbca commit 9041a76
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
12 changes: 11 additions & 1 deletion Classes/TiUIView+WithShadow.m
Expand Up @@ -33,8 +33,18 @@ -(void)setShadow_:(id)args
}

// improve performance
[self.layer setShouldRasterize:YES ];

// [self.layer setShadowPath:[[UIBezierPath bezierPathWithRect:[self bounds] ] CGPath ] ]; // not working yet


if ([args objectForKey:@"shadowPath"] != nil) {
CGRect shadowRect = [TiUtils rectValue:[args objectForKey:@"shadowPath"]] ;
[self.layer setShadowPath:[[UIBezierPath bezierPathWithRect:shadowRect ] CGPath]];
}

if ([args objectForKey:@"rasterize"] != nil) {
[self.layer setShouldRasterize: [TiUtils boolValue:[args objectForKey:@"rasterize"] ]];
}

}
}
Expand Down
4 changes: 3 additions & 1 deletion example/app.js
Expand Up @@ -12,7 +12,9 @@ var view = Ti.UI.createView({
shadow:{
shadowRadius:10,
shadowOpacity:0.5,
shadowOffset:{x:5, y:10}
shadowOffset:{x:10, y:10},
shadowPath:{x:0, y:0, width:100, height:100}, // this improves performance a lot, and is a temporary solution until we find how to get the element's boundaries
rasterize:true // this should improve performance but only if there is no animation that affect the element
}
})

Expand Down
Binary file modified ti.viewshadow-iphone-0.1.zip
Binary file not shown.

0 comments on commit 9041a76

Please sign in to comment.