mirror of
https://github.com/status-im/react-native-linear-gradient.git
synced 2025-01-10 07:45:40 +00:00
35 lines
668 B
Objective-C
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
|