2015-03-31 17:44:16 +00:00
|
|
|
#import "BVLinearGradient.h"
|
2017-01-06 15:16:49 +00:00
|
|
|
#import <React/RCTConvert.h>
|
2015-03-31 18:42:53 +00:00
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
#import <QuartzCore/QuartzCore.h>
|
2015-03-31 17:44:16 +00:00
|
|
|
|
|
|
|
@implementation BVLinearGradient
|
|
|
|
|
2015-03-31 18:42:53 +00:00
|
|
|
+ (Class)layerClass
|
2015-03-31 17:44:16 +00:00
|
|
|
{
|
2015-03-31 18:42:53 +00:00
|
|
|
return [CAGradientLayer class];
|
2015-03-31 17:44:16 +00:00
|
|
|
}
|
|
|
|
|
2015-03-31 18:42:53 +00:00
|
|
|
- (CAGradientLayer *)gradientLayer
|
2015-03-31 17:44:16 +00:00
|
|
|
{
|
2015-03-31 18:42:53 +00:00
|
|
|
return (CAGradientLayer *)self.layer;
|
2015-03-31 17:44:16 +00:00
|
|
|
}
|
|
|
|
|
2015-03-31 18:42:53 +00:00
|
|
|
- (void)setColors:(NSArray *)colorStrings
|
2015-03-31 17:44:16 +00:00
|
|
|
{
|
2015-03-31 18:42:53 +00:00
|
|
|
NSMutableArray *colors = [NSMutableArray arrayWithCapacity:colorStrings.count];
|
|
|
|
for (NSString *colorString in colorStrings) {
|
2015-06-09 05:39:02 +00:00
|
|
|
[colors addObject:(id)[RCTConvert UIColor:colorString].CGColor];
|
2015-03-31 18:42:53 +00:00
|
|
|
}
|
|
|
|
self.gradientLayer.colors = colors;
|
2015-03-31 17:44:16 +00:00
|
|
|
}
|
|
|
|
|
2017-11-16 07:31:10 +00:00
|
|
|
- (void)setStartPoint:(CGPoint)startPoint
|
2015-04-01 00:48:11 +00:00
|
|
|
{
|
2017-11-16 07:31:10 +00:00
|
|
|
self.gradientLayer.startPoint = startPoint;
|
2015-04-01 00:48:11 +00:00
|
|
|
}
|
|
|
|
|
2017-11-16 07:31:10 +00:00
|
|
|
- (void)setEndPoint:(CGPoint)endPoint
|
2015-04-01 00:48:11 +00:00
|
|
|
{
|
2017-11-16 07:31:10 +00:00
|
|
|
self.gradientLayer.endPoint = endPoint;
|
2015-04-01 00:48:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setLocations:(NSArray *)locations
|
|
|
|
{
|
|
|
|
self.gradientLayer.locations = locations;
|
|
|
|
}
|
|
|
|
|
2015-03-31 17:44:16 +00:00
|
|
|
@end
|