react-native-linear-gradient/BVLinearGradient.m

28 lines
573 B
Mathematica
Raw Normal View History

2015-03-31 17:44:16 +00:00
#import "BVLinearGradient.h"
#import "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:[RCTConvert UIColor:colorString].CGColor];
}
self.gradientLayer.colors = colors;
2015-03-31 17:44:16 +00:00
}
@end