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
| [[NSNotificationCenter defaultCenter] addObserver:self | |
| selector:@selector(keyboardWillShown:) | |
| name:UIKeyboardWillShowNotification | |
| object:nil]; | |
| [[NSNotificationCenter defaultCenter] addObserver:self | |
| selector:@selector(keyboardWillHide:) | |
| name:UIKeyboardWillHideNotification | |
| object:nil];} |
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
| Just a snippet. | |
| Note: Don’t push or remove view controllers with non-opaque views. The underlying view of the parent view controller is removed. | |
| [CATransaction begin]; | |
| CATransition *transition = [CATransition animation]; | |
| transition.type = kCATransitionFade; | |
| transition.duration = animated ? 0.5f : 0.0f; | |
| transition.fillMode = kCAFillModeForwards; |
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
| dispatch_queue_t callerQueue = dispatch_get_current_queue(); | |
| dispatch_retain(callerQueue); | |
| dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
| // Do the work in the other thread... | |
| // Example: NSArray* items = parseJSON(data); | |
| dispatch_async(callerQueue, ^{ | |
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
| test |
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
| #define CMLog(format, ...) NSLog(@"%s:%@", __PRETTY_FUNCTION__,[NSString stringWithFormat:format, ## __VA_ARGS__]); | |
| #define MARK CMLog(@"%s", __PRETTY_FUNCTION__); | |
| #define START_TIMER NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate]; | |
| #define END_TIMER(msg) NSTimeInterval stop = [NSDate timeIntervalSinceReferenceDate]; CMLog([NSString stringWithFormat:@"%@ Time = %f", msg, stop-start]); | |
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
| @interface LoaderURL : NSObject | |
| { | |
| NSMutableData *responseData; | |
| NSURLConnection *connectionXML; | |
| } | |
| @property (nonatomic, copy) NSString *xmlFileName; | |
| - (BOOL) updateFile; |
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
| #define NSLogFrame(description,aFrame) NSLog(@"%@ - {%0.0f:%0.0f}{%0.0f:%0.0f}", description, aFrame.origin.x, aFrame.origin.y, aFrame.size.width, aFrame.size.height); | |
| #define NSLogPoint(description,aFrame) NSLog(@"%@ - {%0.0f:%0.0f}{%0.0f:%0.0f}", description, aFrame.origin.x, aFrame.origin.y, aFrame.size.width, aFrame.size.height); |
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
| // | |
| // Lightning.h | |
| // Trundle | |
| // | |
| // Created by Robert Blackwood on 12/1/09. | |
| // Copyright 2009 Mobile Bros. All rights reserved. | |
| // | |
| #import "cocos2d.h" |
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
| - (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration{ | |
| static float prevX=0, prevY=0; | |
| float accelX = acceleration.x * kFilterFactor + (1- kFilterFactor)*prevX; | |
| float accelY = acceleration.y * kFilterFactor + (1- kFilterFactor)*prevY; | |
| prevX = accelX; | |
| prevY = accelY; | |
| pitch = accelX; | |
| } |
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
| myView.layer.shadowOpacity = 0.8; | |
| myView.layer.shadowRadius = 5.0; | |
| myView.layer.shadowOffset = CGSizeZero; | |
| myView.layer.shadowPath = [UIBezierPath bezierPathWithRect:myView.layer.bounds].CGPath; |