Awesome
GBGradientView
GBGradientView
class provides an animated gradient view.
Screenshot
Requirements
GBGradientView
works on iOS 7.1 SDK or later and is compatible with ARC projects.
Adding GBGradientView to your project
Cocoapods
CocoaPods is the recommended way to add GBGradientView to your project.
- Add a pod entry for
GBGradientView
to your Podfilepod 'GBGradientView', '~> 1.0'
- Install the pod(s) by running
pod install
. - Include GBGradientView wherever you need it with
#import <GBGradientView/GBGradientView.h>
.
Source files
You can directly add the header and implementation files to your project.
- Download the latest code version.
- Open your project in Xcode, then drag and drop the header and implementation files onto your project (use the "Product Navigator view"). Make sure to select Copy items when asked if you extracted the code archive outside of your project.
- Include
GBGradientView
wherever you need it with#import <GBGradientView/GBGradientView.h>
.
Usage
This is an example of use:
First, import GBGradientView
lib. Your view controller must conform to the GBGradientViewDelegate
protocol.
#import <UIKit/UIKit.h>
#import <GBGradientView/GBGradientView.h>
@interface GBViewController : UIViewController <GBGradientViewDelegate>
@end
Then, initialize a GBGradientView
new instance.
GBGradientView gradientView = [[GBGradientView alloc] initWithFrame:self.view.bounds
orientation:GBGradientViewOrientationVertical];
gradientView.delegate = self;
gradientView.animationDuration = 3.0f;
gradientView.animationDelay = 3.0f;
[self.view addSubview:gradientView];
Finally, implement the GBGradientViewDelegate
protocols methods.
- (NSArray *)gradientColorsForGradientView:(GBGradientView *)gradientView
{
...
}
- (void)gradientViewAnimationDidStop:(GBGradientView *)gradientView
{
...
}