Study

블러와 그라디언트

zombie45 2013. 9. 8. 20:19
#import <QuartzCore/QuartzCore.h>

...
CAGradientLayer *l = [CAGradientLayer layer];
l.frame = view.bounds;
l.colors = [NSArray arrayWithObjects:(id)[UIColor whiteColor].CGColor, (id)[UIColor clearColor].CGColor, nil];
l.startPoint = CGPointMake(0.5f, 0.0f);
l.endPoint = CGPointMake(0.5f, 1.0f);
v.layer.mask = l;

#import <QuartzCore/QuartzCore.h>

@interface CAFilter : NSObject

+ (id)filterWithName:(NSString*)str;

@end


CAFilter* filter = [CAFilter filterWithName:@"gaussianBlur"];

[filter setValue:[NSNumber numberWithFloat:5] forKey:@"inputRadius"];

self.window.rootViewController.view.layer.filters = [NSArray arrayWithObject:filter];

UIView *whiteView = [[UIView alloc] initWithFrame:CGRectMake(50, 50, 200, 55)];

[whiteView setBackgroundColor:[UIColor whiteColor]];

[self.window addSubview:whiteView];


1)그라디언트 처리

2)블러처리

반응형