Objective-C angle gradients for iOS
Switch branches/tags
Nothing to show
Pull request Compare This branch is 30 commits behind paiv:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
AngleGradient
AngleGradientSample
README.textile
screenshot.png

README.textile

AngleGradientLayer

AngleGradientLayer is a CALayer implementation of angle gradient.

screenshot

Sample usage with UIView

(See demo project for more.)

#import "AngleGradientLayer.h"

@interface MyView : UIView
@end

@implementation MyView

+ (Class)layerClass
{
	return [AngleGradientLayer class];
}

- (id)initWithFrame:(CGRect)frame
{
	if (!(self = [super initWithFrame:frame]))
		return nil;

	AngleGradientLayer *l = (AngleGradientLayer *)self.layer;
	l.colors = [NSArray arrayWithObjects:
		(id)[UIColor colorWithRed:0 green:0 blue:0.5 alpha:1].CGColor,
		(id)[UIColor colorWithRed:1 green:1 blue:0.4 alpha:1].CGColor,
		nil];

	return self;
}

@end

TODO

  1. Add optional anti-aliasing to the algorithm