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
/* | |
UNIQUE IDENTIFIER | |
*/ | |
+ (NSString*) deviceIdentifier { | |
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | |
NSString *deviceId = [defaults objectForKey:DEVICE_ID_KEY]; | |
if (!deviceId) { | |
//Create unique ID | |
CFUUIDRef newUniqueId = CFUUIDCreate(kCFAllocatorDefault); |
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
+ (float_t) batteryLevel { | |
UIDevice *myDevice = [UIDevice currentDevice]; | |
[myDevice setBatteryMonitoringEnabled:YES]; | |
return [myDevice batteryLevel]; | |
} |
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
UIBackgroundTaskIdentifier bgTask; | |
bgTask = [app beginBackgroundTaskWithExpirationHandler:^{ | |
[app endBackgroundTask:bgTask]; | |
}]; | |
self.updateLocationTimer = [NSTimer scheduledTimerWithTimeInterval:UPDATE_INTERVAL target:self selector:@selector(shouldStartLocationUpdate) userInfo:nil repeats:YES]; |
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
#include <iostream> | |
class Objeto { | |
public: | |
int x; | |
}; | |
void objeto_por_valor_modificar_miembro(Objeto o) { | |
o.x = 20; |
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
#include <iostream> | |
class MyObject { | |
public: | |
int x; | |
}; | |
void object_by_value_modify_member(MyObject o) { | |
o.x = 20; |
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
@implementation UINavigationBar (CustomImage) | |
- (void)drawRect:(CGRect)rect { | |
UIImage *image = [UIImage imageNamed: NAVIGATION_BAR_BACKGROUND]; | |
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; | |
} | |
@end | |
@implementation AppDelegate | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
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) viewDidLoad { | |
//... | |
comments.text = @"Comments"; | |
comments.textColor = [UIColor lightGrayColor]; | |
isEmpty = YES; | |
//... | |
} | |
- (BOOL)textViewShouldBeginEditing:(UITextView*)textView { | |
if (isEmpty) { |
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
progressImage.image = [[UIImage imageNamed:@"black_progress_bar"] resizableImageWithCapInsets:UIEdgeInsetsMake(0., leftCap, 0., leftCap)]; |
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
+ (NSDate*) parseISO8601DateString:(NSString*)dateString { | |
ISO8601DateFormatter *formatter = [[ISO8601DateFormatter alloc] init]; | |
formatter.parsesStrictly = YES; | |
NSDate *date = [formatter dateFromString:dateString]; | |
[formatter release]; | |
return [[date retain] autorelease]; | |
} |
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
CGFloat systemVersion = [[[ UIDevice currentDevice ] systemVersion ] floatValue ]; | |
if (systemVersion < 5.0) { | |
} else { | |
} |