react-native-linear-gradient/BVLinearGradient/BVLinearGradient.m

43 lines
852 B
Mathematica
Raw Permalink Normal View History

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