Latest 1.0.0
License MIT
Platforms ios 5.0, requires ARC
Frameworks UIKit


JBGradient classes provide a useful way of adding gradients to UILabels UITextViews and UITextFields. Usually you need to add a gradient to a UIView and then add one of these text display classes as a subview. These gradient classes are subclasses to the standard UI classes mentioned above, so they can be used in the same way as your other labels (etc).


To use the classes add the gradient files to your project and just designate your UILabel, UITextView, or UITextField as a subclass of the JBGradientLabel, JBGradientTextView, JBGradientLabel then set the CGGradientLayer properties for the subclass:

#import "JBGradientLabel.h"
- (void)viewDidLoad {
[super viewDidLoad];

JBGradientLabel *label = [[JBGradientLabel alloc] initWithFrame:CGRectMake(20, 20, 280, 100)];
label.gradientColors =  @[[UIColor blackColor], [UIColor redColor]];
label.textColor = [UIColor whiteColor];
[label setText:@"This is a gradient label!"];
[self.view addSubview:label];

Each UILabel, UITextView, and UITextField each contain the following additional properties:

// For all Gradients
@property (nonatomic, assign) JBGradientType gradientType;

@property (nonatomic, strong) NSArray *gradientColors;
@property (nonatomic, strong) NSArray *gradientLocations;
@property (nonatomic, assign) CGGradientDrawingOptions options;

// For the Linear Gradients
@property (nonatomic, assign) CGPoint startPoint;
@property (nonatomic, assign) CGPoint endPoint;

// For the Radial Gradients
@property (nonatomic, assign) CGPoint startCenter;
@property (nonatomic, assign) CGFloat startRadius;
@property (nonatomic, assign) CGPoint endCenter;
@property (nonatomic, assign) CGFloat endRadius;

To run the example project, clone the repo, and run pod install from the Example directory first.


JBGradientTextViews is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "JBGradientTextViews"


JBGradientTextViews is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "JBGradientTextViews",
    "version": "1.0.0",
    "summary": "JBGradientTextViews adds the ability to add gradients to all your favorite UI text classes!",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "carleek": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.0.0"
    "platforms": {
        "ios": "5.0"
    "requires_arc": true,
    "source_files": "Classes",
    "frameworks": "UIKit"

Pin It on Pinterest

Share This