Skip to content

Instantly share code, notes, and snippets.

@MattFoley
MattFoley / gist:5601191
Created May 17, 2013 18:58
UIColorFromRGB, call like "UIColorFromRGB(0xFFFFFF)"
//Function to convert RGB values into Hexadecimal/Base16
#define UIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
@MattFoley
MattFoley / Remove Webviews
Created April 25, 2013 15:00
Removing Webview Shadows.
- (void)removeShadows
{
self.opaque = NO;
self.backgroundColor = [UIColor clearColor];
for(UIView *view in self.subviews){
if ([view isKindOfClass:[UIImageView class]]) {
[view removeFromSuperview];
}
if ([view isKindOfClass:[UIScrollView class]]) {
@MattFoley
MattFoley / gist:5222512
Created March 22, 2013 16:06
Literal Syntax Magic: Not only can literal syntax do assignment, creation, and re-assignment; it can also do addObject:
NSMutableArray *objects = [@[] mutableCopy];
NSObject *someObject = [NSObject new];
objects[objects.count] = object;
@MattFoley
MattFoley / gist:4945666
Created February 13, 2013 16:08
Helpful PCH Macros.
#define screenHeight() ([UIScreen mainScreen].bounds.size.height)
#define isPhoneFive() (screenHeight() == 568)
#define isOS6() ([[[UIDevice currentDevice] systemVersion]intValue] > 5.2)
#define UIInterfaceIdiomIsPad() (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define UIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \