Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsiton committed Dec 22, 2013
1 parent 732379d commit 800cad3
Show file tree
Hide file tree
Showing 31 changed files with 1,803 additions and 0 deletions.
534 changes: 534 additions & 0 deletions AUIAutoLayoutAnimator.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges</key>
<true/>
<key>SnapshotAutomaticallyBeforeSignificantChanges</key>
<false/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "662C2B7D18673B6700391AEF"
BuildableName = "AUIAutoLayoutAnimator.app"
BlueprintName = "AUIAutoLayoutAnimator"
ReferencedContainer = "container:AUIAutoLayoutAnimator.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "662C2B9E18673B6800391AEF"
BuildableName = "AUIAutoLayoutAnimatorTests.xctest"
BlueprintName = "AUIAutoLayoutAnimatorTests"
ReferencedContainer = "container:AUIAutoLayoutAnimator.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "662C2B7D18673B6700391AEF"
BuildableName = "AUIAutoLayoutAnimator.app"
BlueprintName = "AUIAutoLayoutAnimator"
ReferencedContainer = "container:AUIAutoLayoutAnimator.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "662C2B7D18673B6700391AEF"
BuildableName = "AUIAutoLayoutAnimator.app"
BlueprintName = "AUIAutoLayoutAnimator"
ReferencedContainer = "container:AUIAutoLayoutAnimator.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "662C2B7D18673B6700391AEF"
BuildableName = "AUIAutoLayoutAnimator.app"
BlueprintName = "AUIAutoLayoutAnimator"
ReferencedContainer = "container:AUIAutoLayoutAnimator.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>AUIAutoLayoutAnimator.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>662C2B7D18673B6700391AEF</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>662C2B9E18673B6800391AEF</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
40 changes: 40 additions & 0 deletions AUIAutoLayoutAnimator/AUIAutoLayoutAnimator-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.adamsiton.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
16 changes: 16 additions & 0 deletions AUIAutoLayoutAnimator/AUIAutoLayoutAnimator-Prefix.pch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//

#import <Availability.h>

#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif

#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by Adam on 10/17/13.
//


#import <Foundation/Foundation.h>
#import "NSBKeyframeAnimation+Animations.h"

@interface AUIAutoLayoutAnimator : NSObject

- (id)initWithView:(UIImageView *)view heightConstraint:(NSLayoutConstraint *)heightConstraint widthConstraint:(NSLayoutConstraint *)widthConstraint;

- (void)scaleViewToScale:(float)scale withAnimationFunction:(NSBAnimationType)function andDuration:(float)duration;

- (void) stopAnimation;
@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
//
// Created by Adam on 10/17/13.
//


#import "AUIAutoLayoutAnimator.h"
#import "NSBKeyframeAnimation+Animations.h"
#import "NSBKeyframeAnimation+AUIExtensions.h"

@interface AUIAutoLayoutAnimator ()
@property(nonatomic, strong) UIImageView *view;
@property(nonatomic, strong) NSLayoutConstraint *heightConstraint;
@property(nonatomic, strong) NSLayoutConstraint *widthConstraint;
@property(nonatomic, strong) NSTimer *timer;
@property (nonatomic) int numberOfSteps;
@property (nonatomic, strong) NSArray *heightValues;
@property (nonatomic, strong) NSArray *widthValues;
@property (nonatomic) NSUInteger currentStep;

@end

@implementation AUIAutoLayoutAnimator {

}

- (id)initWithView:(UIImageView *)view heightConstraint:(NSLayoutConstraint *)heightConstraint widthConstraint:(NSLayoutConstraint *)widthConstraint {
self = [super init];
if (self) {
self.view = view;
self.heightConstraint = heightConstraint;
self.widthConstraint = widthConstraint;
}
return self;
}

- (void)scaleViewToScale:(float)scale withAnimationFunction:(NSBAnimationType)function andDuration:(float)duration {
self.heightValues = [NSBKeyframeAnimation calculatePositionValuesForFunction:function startValue:self.heightConstraint.constant endValue:self.heightConstraint.constant*scale withDuration:duration];
self.widthValues = [NSBKeyframeAnimation calculatePositionValuesForFunction:function startValue:self.widthConstraint.constant endValue:self.widthConstraint.constant*scale withDuration:duration];
self.numberOfSteps = [NSBKeyframeAnimation numberOfStepsForDuration:1.0];
self.currentStep = 0;
float stepDuration = (duration / self.numberOfSteps);
// Change the timer interval for speed regulation.
self.timer = [NSTimer scheduledTimerWithTimeInterval:stepDuration target:self selector:@selector(animateView:) userInfo:nil repeats:YES];
}

-(void)stopAnimation {
[self.timer invalidate];
self.timer = nil;
}

-(void) animateView:(NSTimer *)timer
{
if (self.currentStep == self.numberOfSteps) {
self.heightConstraint.constant = [[self.heightValues lastObject] floatValue];
self.widthConstraint.constant = [[self.widthValues lastObject] floatValue];
[self.view layoutIfNeeded];

[timer invalidate];
self.timer = nil;
}
else {
self.heightConstraint.constant = [self.heightValues[self.currentStep] floatValue];
self.widthConstraint.constant = [self.widthValues[self.currentStep] floatValue];
self.currentStep++;
[self.view layoutIfNeeded];
}
}

@end
15 changes: 15 additions & 0 deletions AUIAutoLayoutAnimator/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// AppDelegate.h
// AUIAutoLayoutAnimator
//
// Created by Adam on 12/22/13.
// Copyright (c) 2013 adamsiton. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end
46 changes: 46 additions & 0 deletions AUIAutoLayoutAnimator/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// AppDelegate.m
// AUIAutoLayoutAnimator
//
// Created by Adam on 12/22/13.
// Copyright (c) 2013 adamsiton. All rights reserved.
//

#import "AppDelegate.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
Loading

0 comments on commit 800cad3

Please sign in to comment.