
RGSRadialGradientView
A simple Radial Gradient View for iOS.
Installation
RGSRadialGradientView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "RGSRadialGradientView"
Using a RGSRadialGradientView from a View Controller
...
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
...
self.argv = [[RGSRadialGradientView alloc] initWithFrame:CGRectMake(self.view.center.x - 100, 30, 200,200)];
self.argv.interColor = [UIColor colorWithRed:0.16 green:0.50 blue:0.73 alpha:1.0];
self.argv.outerColor = [UIColor colorWithRed:0.91 green:0.30 blue:0.24 alpha:1.0];
self.argv.radius = CGRectGetWidth(self.argv.frame)/2;
self.argv.backgroundColor = [UIColor clearColor];
[self.view addSubview:self.argv];
...
}
-(void)viewDidLayoutSubviews{
[super viewDidLayoutSubviews];
...
self.argv.gradientCenter = CGPointMake(CGRectGetWidth(self.argv.frame)/2, CGRectGetHeight(self.argv.frame)/2);
...
}
###Todo As of now RGSRadialGradientView is very simplistic, but over time I hope it can grow into a first class object like : https://developer.mozilla.org/en-US/docs/Web/CSS/radial-gradient.
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
License
RGSRadialGradientView is available under the MIT license. See the LICENSE file for more info.