Skip to content

Instantly share code, notes, and snippets.

@JJSaccolo
JJSaccolo / pauseAndResumeAnimations.m
Created December 9, 2013 13:14
Pause and resume animations in a layer tree
-(void)pauseLayer:(CALayer*)layer
{
CFTimeInterval pausedTime = [layer convertTime:CACurrentMediaTime() fromLayer:nil];
layer.speed = 0.0;
layer.timeOffset = pausedTime;
}
-(void)resumeLayer:(CALayer*)layer
{
CFTimeInterval pausedTime = [layer timeOffset];
@JJSaccolo
JJSaccolo / MYDocumentHandler.h
Created May 15, 2013 15:22
Core Data with a Single Shared UIManagedDocument
#import <Foundation/Foundation.h>
typedef void (^OnDocumentReady) (UIManagedDocument *document);
@interface MYDocumentHandler : NSObject
@property (strong, nonatomic) UIManagedDocument *document;
+ (MYDocumentHandler *)sharedDocumentHandler;
- (void)performWithDocument:(OnDocumentReady)onDocumentReady;
@JJSaccolo
JJSaccolo / AppDelegate.m
Created November 29, 2012 21:53 — forked from albertodebortoli/AppDelegate.m
iPhone splash screen fade out animation
// in application:didFinishLaunchingWithOptions: in app delegate
// before [window makeKeyAndVisible];
int height;
NSString *imageName;
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if (screenBounds.size.height == 480) {
height = 480;
imageName = @"Default.png";
} else {