if(hex.length == 3){
hex = [hex stringByAppendingString:hex];
}
NSString *red = [hex substringToIndex:2];
NSString *green = [hex substringWithRange:NSMakeRange(2, 2)];
NSString *blue = [hex substringFromIndex:4];
unsigned int redI = 255;
unsigned int greenI = 255;
unsigned int blueI = 255;
NSScanner *scan_red = [NSScanner scannerWithString:red];
[scan_red scanHexInt:&redI];
NSScanner *scan_green = [NSScanner scannerWithString:green];
[scan_green scanHexInt:&greenI];
NSScanner *scan_blue = [NSScanner scannerWithString:blue];
[scan_blue scanHexInt:&blueI];
UIColor *color = [UIColor colorWithRed:redI/255.0 green:greenI/255.0 blue:blueI/255.0 alpha:1.0];