https://github.com/jakemarsh/jmlayerstyles
A small library built around the concept of a UIView in a similar way to what you would in a Photoshop layer.
https://github.com/jakemarsh/jmlayerstyles
Last synced: 8 months ago
JSON representation
A small library built around the concept of a UIView in a similar way to what you would in a Photoshop layer.
- Host: GitHub
- URL: https://github.com/jakemarsh/jmlayerstyles
- Owner: jakemarsh
- License: mit
- Created: 2012-01-26T14:02:35.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2012-10-24T21:30:23.000Z (over 13 years ago)
- Last Synced: 2025-08-29T06:19:37.098Z (10 months ago)
- Language: Objective-C
- Homepage: http://deallocatedobjects.com
- Size: 144 KB
- Stars: 16
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: MIT-LICENSE
Awesome Lists containing this project
README
## JMLayerStyles
**OMG A SPECIAL NOTE!** While I am using this in a couple places in my own projects, I wouldn't recommend just tossing it into yours just yet. I'm open-sourcing it now mainly to get some thoughts from everyone on where to take it. It's still very custom to my own needs.
`JMLayerStyles` is a set of tools built around a small little UIView subclass that supports being styled by invoking methods whose parameters are quite similar to those found on Photoshop's "Layer Styles" panel.
The end result looks like this:
``` objc
JMStylableView *styledView = [[JMStylableView alloc] initWithFrame:CGRectMake(10.0, 30.0, self.window.bounds.size.width - 20.0, self.window.bounds.size.height - 40.0)];
[styledView addLayerStyle:[DropShadowLayerStyle dropShadowStyleWithColor:[UIColor colorWithWhite:0.0 alpha:0.56]
distance:4.0
size:4.5]];
[styledView addLayerStyle:[InnerShadowLayerStyle innerShadowStyleWithColor:[UIColor colorWithRed:71.0/255.0 green:159.0/255.0 blue:243.0/255.0 alpha:1.0]
opacity:1.0
distance:1.0
choke:0.0
size:0.0]];
[styledView addLayerStyle:[StrokeLayerStyle strokeStyleWithColor:[UIColor colorWithRed:3.0/255.0 green:25.0/255.0 blue:47.0/255.0 alpha:1.0]
opacity:1.0
size:1.0]];
NSArray *colors = [NSArray arrayWithObjects:[UIColor colorWithRed:19.0/255.0 green:148.0/255.0 blue:213.0/255.0 alpha:1.0], [UIColor colorWithRed:10.0/255.0 green:71.0/255.0 blue:131.0/255.0 alpha:1.0], nil];
[styledView addLayerStyle:[GradientOverlayLayerStyle gradientStyleWithColors:colors style:GradientOverlayStyleLinear]];
styledView.cornerRadius = 10.0;
[self.window addSubview:styledView];
[styledView release];
```