-
Notifications
You must be signed in to change notification settings - Fork 0
/
BVLinearGradient.m
42 lines (34 loc) · 858 Bytes
/
BVLinearGradient.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#import "BVLinearGradient.h"
#import "RCTConvert.h"
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@implementation BVLinearGradient
+ (Class)layerClass
{
return [CAGradientLayer class];
}
- (CAGradientLayer *)gradientLayer
{
return (CAGradientLayer *)self.layer;
}
- (void)setColors:(NSArray *)colorStrings
{
NSMutableArray *colors = [NSMutableArray arrayWithCapacity:colorStrings.count];
for (NSString *colorString in colorStrings) {
[colors addObject:[RCTConvert UIColor:colorString].CGColor];
}
self.gradientLayer.colors = colors;
}
- (void)setStart:(NSArray *)start
{
self.gradientLayer.startPoint = [RCTConvert CGPoint:start];
}
- (void)setEnd:(NSArray *)end
{
self.gradientLayer.endPoint = [RCTConvert CGPoint:end];
}
- (void)setLocations:(NSArray *)locations
{
self.gradientLayer.locations = locations;
}
@end