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
@interface UIColor (HexEncoding) | |
+ (UIColor*)colorFromString:(NSString*)string; | |
- (NSString*)encodeToString; | |
@end | |
@implementation UIColor (HexEncoding) | |
+ (UIColor*) | |
colorFromString:(NSString*)string | |
{ |
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
NSFileManager * theFM = [NSFileManager defaultManager]; | |
NSDictionary * fileProperties = [theFM fileSystemAttributesAtPath:[[NSBundle mainBundle] bundlePath]]; | |
NSInteger freeSpace = [[fileProperties objectForKey:NSFileSystemFreeSize] integerValue]; | |
NSLog(@"We have %d free",freeSpace); |
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
@class UIAnimation; | |
@interface UIAnimator : NSObject {} | |
+ (id)sharedAnimator; | |
+ (void)disableAnimation; | |
+ (void)enableAnimation; | |
- (void)addAnimation:(UIAnimation *)animation withDuration:(double)duration start:(BOOL)start; | |
- (void)addAnimations:(NSArray *)animations withDuration:(double)duration start:(BOOL)start; | |
- (void)removeAnimationsForTarget:(id)target; | |
- (void)removeAnimationsForTarget:(id)target ofKind:(Class)classOfTarget; |
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
#import <mach/mach.h> | |
#import <mach/mach_host.h> | |
static void print_free_memory () { | |
mach_port_t host_port; | |
mach_msg_type_number_t host_size; | |
vm_size_t pagesize; | |
host_port = mach_host_self(); | |
host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t); |
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
#import "UIViewTouch.h" | |
#import <MapKit/MapKit.h> | |
@implementation UIViewTouch | |
@synthesize viewTouched; | |
//The basic idea here is to intercept the view which is sent back as the firstresponder in hitTest. | |
//We keep it preciously in the property viewTouched and we return our view as the firstresponder. | |
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { | |
NSLog(@"Hit Test"); |
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
#import <UIKit/UIKit.h> | |
@class UIView; | |
@interface UIViewTouch : UIView { | |
UIView *viewTouched; | |
} | |
@property (nonatomic, retain) UIView * viewTouched; | |
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event; |
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
static void addRoundedRectToPath(CGContextRef context, | |
CGRect rect, | |
float ovalWidth, | |
float ovalHeight, | |
int i | |
{ | |
float fw, fh; | |
if (ovalWidth == 0 || ovalHeight == 0) { | |
CGContextAddRect(context, rect); | |
return; |
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
Step 1: Copy the URL of your full app from the App Store by right-clicking its name, which will be something like | |
http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=306469222&mt=8 | |
Step 2: Replace “itunes” with “phobos”. This is so it doesn’t start Safari. | |
http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=306469222&mt=8 | |
Step 3: Have the system load it. |
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 *htmlBody = @"you probably want something HTML-y here"; | |
// First escape the body using a CF call | |
NSString *escapedBody = [(NSString*)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)htmlBody, NULL, CFSTR("?=&+"), kCFStringEncodingUTF8) autorelease]; | |
// Then escape the prefix using the NSString method | |
NSString *mailtoPrefix = [@"mailto:?subject=Some Subject&body=" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; | |
// Finally, combine to create the fully escaped URL string | |
NSString *mailtoStr = [mailtoPrefix stringByAppendingString:escapedBody]; |
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
#import <UIKit/UIKit.h> | |
#import <UIKit/UIApplication.h> | |
#include <dlfcn.h> | |
#include <stdio.h> | |
// Framework Paths | |
#define SBSERVPATH "/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices" | |
#define UIKITPATH "/System/Library/Framework/UIKit.framework/UIKit" | |
int main(int argc, char **argv) |
OlderNewer