Skip to content

mobilemagicdevelopers/UIColor-iOS7Colors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

UIColor+iOS7Colors

UIColor+iOS7Colors adds convenience accessors for some nice looking colors for iOS 7 I found on ios7colors.com.

Usage

Use this the same way you use any other category. You should be able to use the familiar UIColor static helper syntax.

  1. #import "UIColor+iOS7Colors.h"
  2. [UIColor iOS7orangeColor]
  3. Profit

Gradients

Gradient usage is a smidgen more complicated because gradients are more complicated. Here's a snippet (slighly modified for clarity) from a recent project that was the impetus for my adding gradients:

NSArray *gradientColors = [UIColor iOS7greenGradient];
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
    
CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, (CFArrayRef)gradientColors, NULL);
CGColorSpaceRelease(colorSpace), colorSpace = NULL;
    
CGPoint startPoint = square.origin;
CGPoint endPoint = CGPointMake(square.origin.x, CGRectGetMaxY(square));
CGContextDrawLinearGradient(context, gradient, startPoint, endPoint, 0);
CGGradientRelease(gradient), gradient = NULL;

Kudos

License

MIT License

About

I category to add iOS7 color helper accessors to UIColor.

Resources

License

Stars

Watchers

Forks

Packages