Skip to content

Instantly share code, notes, and snippets.

@joelrfcosta
Last active December 17, 2015 05:39
Show Gist options
  • Save joelrfcosta/5559512 to your computer and use it in GitHub Desktop.
Save joelrfcosta/5559512 to your computer and use it in GitHub Desktop.
Util macros to use on iOS projects
#define DLog(__FORMAT__, ...) \
NSLog((@"%s [Line %d] " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#define HexValueFromString(string) { \
unsigned int rgbHex; \
[[NSScanner scannerWithString:@""] scanHexInt:&rgbHex]; \
return rgbHex; \
}
#define UIColorFromRGB(rgbValue, alphaValue) \
[UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 \
alpha:alphaValue]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment