This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NULL (void *)0 literal null value for C pointers | |
nil (id)0 literal null value for Objective-C objects | |
Nil (Class)0 literal null value for Objective-C classes | |
NSNull [NSNull null] singleton object used to represent null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma clang diagnostic push | |
// Code that produces warnings | |
#pragma clang diagnostic pop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)method | |
{ | |
CGPoint velocity = [sender translationInView:view]; | |
if (sender.state == UIGestureRecognizerStateEnded) | |
{ | |
if (velocity.x > 0) | |
{ | |
[self switchedCarsWithDirection:LEFT]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define WINDOW_WIDTH [[UIScreen mainScreen] bounds].size.width | |
#define WINDOW_HEIGHT [[UIScreen mainScreen] bounds].size.height |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *numberWithCommas = [NSNumberFormatter localizedStringFromNumber:@(intNumber) | |
numberStyle:NSNumberFormatterDecimalStyle]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (AppDelegate *)instance | |
{ | |
return (AppDelegate *)[UIApplication sharedApplication].delegate; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Adds a shadow to sampleView | |
CALayer *layer = self.sampleView.layer; | |
layer.shadowOffset = CGSizeMake(1, 1); | |
layer.shadowColor = [[UIColor blackColor] CGColor]; | |
layer.shadowRadius = 4.0f; | |
layer.shadowOpacity = 0.80f; | |
layer.shadowPath = [[UIBezierPath bezierPathWithRect:layer.bounds] CGPath]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *mapsURL = @"http://maps.google.com/maps?q="; | |
if ([[[[UIDevice currentDevice] systemVersion] substringToIndex:1] intValue] >= 6) // if iOS 6 or greater use apple maps | |
{ | |
mapsURL = @"http://maps.apple.com/maps?q="; | |
} | |
NSString *mapaddress = [mapsURL stringByAppendingString:address]; | |
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[mapaddress stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]]; |