This file contains hidden or 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
+(BOOL)deviceIsRunningOS5 | |
{ | |
UIScreen *s = [UIScreen mainScreen]; | |
return [s respondsToSelector:@selector(brightness)]; | |
} |
This file contains hidden or 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
_netRequests--; | |
if(_netRequests == 0) [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; |
This file contains hidden or 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 *)createUUID | |
{ | |
// Create universally unique identifier (object) | |
CFUUIDRef uuidObject = CFUUIDCreate(kCFAllocatorDefault); | |
// Get the string representation of CFUUID object. | |
NSString *uuidStr = [(NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuidObject) autorelease]; | |
// If needed, here is how to get a representation in bytes, returned as a structure | |
// typedef struct { |
This file contains hidden or 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
[self.view endEditing:YES]; |
This file contains hidden or 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
ASIHTTPRequest *req = [ASIHTTPRequest requestWithURL:URL]; | |
req.delegate = self; | |
req.userInfo = [NSDictionary dictionaryWithObject:@"initialRequest" forKey:@"type"]; | |
NSData *body = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; | |
[req appendPostData:body]; | |
[req startSynchronous]; |
This file contains hidden or 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
CALayer *capa = [self.navigationController navigationBar].layer; | |
[capa setShadowColor: [[UIColor blackColor] CGColor]]; | |
[capa setShadowOpacity:0.85f]; | |
[capa setShadowOffset: CGSizeMake(0.0f, 1.5f)]; | |
[capa setShadowRadius:2.0f]; | |
[capa setShouldRasterize:YES]; | |
//Round | |
CGRect bounds = capa.bounds; |
This file contains hidden or 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
//.h | |
@protocol XXXXXXDelegate <NSObject> | |
@optional | |
@end | |
@property (nonatomic, weak) id <XXXXXXDelegate> delegate; | |
This file contains hidden or 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
NSArray* reversedArray = [[startArray reverseObjectEnumerator] allObjects]; |
This file contains hidden or 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
// | |
// CWLSynthesizeSingleton.h | |
// CocoaWithLove | |
// | |
// Created by Matt Gallagher on 2011/08/23. | |
// Copyright (c) 2011 Matt Gallagher. All rights reserved. | |
// | |
// Permission is given to use this source code file, free of charge, in any | |
// project, commercial or otherwise, entirely at your risk, with the condition | |
// that any redistribution (in part or whole) of source code must retain |
This file contains hidden or 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
NSError *error; | |
NSData *body = [NSJSONSerialization dataWithJSONObject:payJSON options:NSJSONWritingPrettyPrinted error:&error]; | |
NSString *jsonString = [[NSString alloc] initWithData:body encoding:NSUTF8StringEncoding]; |
OlderNewer