CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

GBGradientView 1.0

GBGradientView 1.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Gerardo Blanco.



  • By
  • Gerardo Blanco

GBGradientView class provides an animated gradient view.

Screenshot

Alt Screenshot

Requirements

GBGradientView works on iOS 7.1 SDK or later and is compatible with ARC projects.

Adding GBGradientView to your project

Source files

You can directly add the header and implementation files to your project.

  1. Download the latest code version.
  2. 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.
  3. 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 <GBGradientVieDelegate>

@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 GBGradientVieDelegate protocols methods.

- (NSArray *)gradientColorsForGradientView:(GBGradientView *)gradientView
{
    ...
}

- (void)gradientViewAnimationDidStop:(GBGradientView *)gradientView
{
    ...
}