- (UIColor *) getColor: (NSString *) hexColor//method for converting hexadecimal into colors.
    {
        unsigned int red, green, blue;//declaring colors of unsigned int type.

        NSRange range;//range

        range.length = 2;//length of range.

        range.location = 0; //location of range.

        [[NSScanner scannerWithString:[hexColor substringWithRange:range]] scanHexInt:&red];//scannig red color.

        range.location = 2;//location of red.

        [[NSScanner scannerWithString:[hexColor substringWithRange:range]] scanHexInt:&green];//scanning green color.

        range.location = 4;//location of green.

        [[NSScanner scannerWithString:[hexColor substringWithRange:range]] scanHexInt:&blue];//scanning blue color. 

        return [UIColor colorWithRed:(float)(red/255.0f) green:(float)(green/255.0f) blue:(float)(blue/255.0f) alpha:1.0f];//returning customized colors.
    }
Advertisements