Latest 1.0.0
Homepage https://github.com/carleek/JBGradientTextViews
License MIT
Platforms ios 5.0, requires ARC
Frameworks UIKit
Authors

Version
License
Platform

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).

Usage

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.

Installation

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

pod "JBGradientTextViews"

License

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": "https://github.com/carleek/JBGradientTextViews",
    "license": "MIT",
    "authors": {
        "carleek": "[email protected]"
    },
    "source": {
        "git": "https://github.com/carleek/JBGradientTextViews.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "5.0"
    },
    "requires_arc": true,
    "source_files": "Classes",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This