UIColor+ColorWithHex is a category method for iOS UIColor, inspired by the lack of hexadecimal colour integration of iOS.
UIColor+ColorWithHex Download Link
GitHub
Sample Usage:
[[self view] setBackgroundColor: [UIColor colorWithHex: 0xff0000]];
UIColor *randomColor = [UIColor randomColor];
Methods:
+ (UIColor *)colorWithHex:(UInt32)hexadecimal;
+ (UIColor *)colorWithHexString:(NSString *)hexadecimal;
+ (UIColor *)colorWithAlphaHex:(UInt32)hexadecimal;
+ (UIColor *)colorWithAlphaHexString:(NSString *)hexadecimal;
+ (NSString *)hexStringFromColor: (UIColor *)color;
+ (UIColor *)randomColor;
// ObjC (manual hex conversion to RGB)
+ (UIColor *)colorWithHexa:(NSString *)hexadecimal;

When writing our own program, you’ll often want to add some new method to an existing class. You can always add a subclass to an existing class if you want to add some more method to it. But there are limitations to that, not every time subclassing is convenient enough for people to subclass. For example, you want to add an email address validator method to NSString, but NSString is the top of the hierarchy of the class cluster, which makes it difficult to subclass.
Note: A class cluster is an architecture that groups a number of private, concrete subclasses under a public, abstract superclass. The grouping of classes in this way provides a simplified interface to the user, who sees only the publicly visible architecture. Read more about class clusters here: http://developer.apple.com/library/mac/#documentation/General/
Conceptual/DevPedia-CocoaCore/ClassCluster.html
But because of the difficulties, Objective-C has this brilliant mechanism that will let you add a new method to an existing class without any difficulties. The term for is called Categories.
Creating a Category Method
A category is a way to add a new method to an existing class even if you don’t have the source code for it. Let’s say you want to add an NSString method that …