react-native-linear-gradient/BVLinearGradient.m
2015-03-31 10:44:16 -07:00

35 lines
668 B
Objective-C

#import "BVLinearGradient.h"
@implementation BVLinearGradient
{
CAGradientLayer *_layer;
}
- (id)init
{
if ((self = [super init])) {
NSArray *colors = [NSArray arrayWithObjects:
(id)[UIColor whiteColor].CGColor,
(id)[UIColor redColor].CGColor,
nil];
*_layer = [CAGradientLayer _layer];
[_layer setColors:colors];
[layer setFrame:self.bounds];
[self.layer insertSublayer:_layer atIndex:0];
self.clipToBounds = YES;
}
return self;
}
- (void)setColors:(NSArray *)colors
{
}
- (void)layoutSubviews
{
[super layoutSubviews];
[layer setFrame:self.bounds];
}
@end