Browse files

Rudimentary sample.

  • Loading branch information...
1 parent 43405ff commit a7f737d862b3f588ff991aa12d5f1a01dc8a6df8 Justin Williams committed Jul 12, 2013
View
23 SGSmokeScreenSample.xcodeproj/project.pbxproj
@@ -22,6 +22,8 @@
D0A2125317905C7B00B0368B /* SGSmokeScreenAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A2124E17905C7B00B0368B /* SGSmokeScreenAnimation.m */; };
D0A2125417905C7B00B0368B /* SGSmokeScreenViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A2125017905C7B00B0368B /* SGSmokeScreenViewController.m */; };
D0A2125517905C7B00B0368B /* UIView+Screenshots.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A2125217905C7B00B0368B /* UIView+Screenshots.m */; };
+ D0A2125817905E3400B0368B /* SGFirstViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A2125717905E3400B0368B /* SGFirstViewController.m */; };
+ D0A212601790649600B0368B /* SGSecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A2125E1790649600B0368B /* SGSecondViewController.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -57,6 +59,10 @@
D0A2125017905C7B00B0368B /* SGSmokeScreenViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGSmokeScreenViewController.m; sourceTree = "<group>"; };
D0A2125117905C7B00B0368B /* UIView+Screenshots.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Screenshots.h"; sourceTree = "<group>"; };
D0A2125217905C7B00B0368B /* UIView+Screenshots.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Screenshots.m"; sourceTree = "<group>"; };
+ D0A2125617905E3400B0368B /* SGFirstViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFirstViewController.h; sourceTree = "<group>"; };
+ D0A2125717905E3400B0368B /* SGFirstViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFirstViewController.m; sourceTree = "<group>"; };
+ D0A2125D1790649600B0368B /* SGSecondViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGSecondViewController.h; sourceTree = "<group>"; };
+ D0A2125E1790649600B0368B /* SGSecondViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGSecondViewController.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -119,7 +125,10 @@
children = (
D0A2122C17905C4500B0368B /* SGAppDelegate.h */,
D0A2122D17905C4500B0368B /* SGAppDelegate.m */,
- D0A2122F17905C4500B0368B /* Images.xcassets */,
+ D0A2125617905E3400B0368B /* SGFirstViewController.h */,
+ D0A2125717905E3400B0368B /* SGFirstViewController.m */,
+ D0A2125D1790649600B0368B /* SGSecondViewController.h */,
+ D0A2125E1790649600B0368B /* SGSecondViewController.m */,
D0A2122417905C4500B0368B /* Supporting Files */,
);
path = SGSmokeScreenSample;
@@ -128,6 +137,7 @@
D0A2122417905C4500B0368B /* Supporting Files */ = {
isa = PBXGroup;
children = (
+ D0A2122F17905C4500B0368B /* Images.xcassets */,
D0A2122517905C4500B0368B /* SGSmokeScreenSample-Info.plist */,
D0A2122617905C4500B0368B /* InfoPlist.strings */,
D0A2122917905C4500B0368B /* main.m */,
@@ -215,6 +225,9 @@
LastUpgradeCheck = 0500;
ORGANIZATIONNAME = "Second Gear";
TargetAttributes = {
+ D0A2121917905C4500B0368B = {
+ DevelopmentTeam = FS79T9Y9ZN;
+ };
D0A2123417905C4500B0368B = {
TestTargetID = D0A2121917905C4500B0368B;
};
@@ -266,8 +279,10 @@
D0A2125417905C7B00B0368B /* SGSmokeScreenViewController.m in Sources */,
D0A2125317905C7B00B0368B /* SGSmokeScreenAnimation.m in Sources */,
D0A2122E17905C4500B0368B /* SGAppDelegate.m in Sources */,
+ D0A2125817905E3400B0368B /* SGFirstViewController.m in Sources */,
D0A2125517905C7B00B0368B /* UIView+Screenshots.m in Sources */,
D0A2122A17905C4500B0368B /* main.m in Sources */,
+ D0A212601790649600B0368B /* SGSecondViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -382,9 +397,11 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
+ CODE_SIGN_IDENTITY = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "SGSmokeScreenSample/SGSmokeScreenSample-Prefix.pch";
INFOPLIST_FILE = "SGSmokeScreenSample/SGSmokeScreenSample-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 6.0;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -395,9 +412,11 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
+ CODE_SIGN_IDENTITY = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "SGSmokeScreenSample/SGSmokeScreenSample-Prefix.pch";
INFOPLIST_FILE = "SGSmokeScreenSample/SGSmokeScreenSample-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 6.0;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -462,6 +481,7 @@
D0A2124817905C4500B0368B /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
D0A2124917905C4500B0368B /* Build configuration list for PBXNativeTarget "SGSmokeScreenSampleTests" */ = {
isa = XCConfigurationList;
@@ -470,6 +490,7 @@
D0A2124B17905C4500B0368B /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
View
3 SGSmokeScreenSample/SGAppDelegate.h
@@ -10,6 +10,7 @@
@interface SGAppDelegate : UIResponder <UIApplicationDelegate>
-@property (strong, nonatomic) UIWindow *window;
+@property (nonatomic, strong) UIWindow *window;
+@property (nonatomic, strong) UINavigationController *navigationController;
@end
View
8 SGSmokeScreenSample/SGAppDelegate.m
@@ -7,6 +7,7 @@
//
#import "SGAppDelegate.h"
+#import "SGFirstViewController.h"
@implementation SGAppDelegate
@@ -15,6 +16,13 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
+
+ SGFirstViewController *firstViewController = [[SGFirstViewController alloc] init];
+
+ self.navigationController = [[UINavigationController alloc] initWithRootViewController:firstViewController];
+
+ self.window.rootViewController = self.navigationController;
+
[self.window makeKeyAndVisible];
return YES;
}
View
13 SGSmokeScreenSample/SGFirstViewController.h
@@ -0,0 +1,13 @@
+//
+// SGFirstViewController.h
+// SGSmokeScreenSample
+//
+// Created by Justin Williams on 7/12/13.
+// Copyright (c) 2013 Second Gear. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface SGFirstViewController : UIViewController
+
+@end
View
103 SGSmokeScreenSample/SGFirstViewController.m
@@ -0,0 +1,103 @@
+//
+// SGFirstViewController.m
+// SGSmokeScreenSample
+//
+// Created by Justin Williams on 7/12/13.
+// Copyright (c) 2013 Second Gear. All rights reserved.
+//
+
+#import "SGFirstViewController.h"
+#import "SGSecondViewController.h"
+#import "SGSmokeScreenAnimation.h"
+#import "UIView+Screenshots.h"
+#import "SGSmokeScreenViewController.h"
+
+
+@interface SGFirstViewController ()
+@property (nonatomic, strong) UIButton *transitionButton;
+@end
+
+@implementation SGFirstViewController
+
+- (instancetype)init
+{
+
+ if (self = [super initWithNibName:nil bundle:nil])
+ {
+ // Custom initialization
+ }
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ self.title = NSLocalizedString(@"First", @"");
+ self.view.backgroundColor = [UIColor orangeColor];
+
+ self.transitionButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
+ self.transitionButton.translatesAutoresizingMaskIntoConstraints = NO;
+ [self.transitionButton setTitle:@"Moo" forState:UIControlStateNormal];
+ [self.transitionButton addTarget:self action:@selector(transition:) forControlEvents:UIControlEventTouchUpInside];
+
+ [self.view addSubview:self.transitionButton];
+
+ [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.transitionButton attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0.0]];
+
+ [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.transitionButton attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0.0]];
+}
+
+- (void)transition:(id)sender
+{
+ SGSecondViewController *secondViewController = [[SGSecondViewController alloc] init];
+
+ SGSmokeScreenViewController *smokeScreenViewController = [[SGSmokeScreenViewController alloc] initWithStartingViewController:self destinationViewController:secondViewController];
+
+ UIImageView *screenshot = [UIView screenshotForScreen];
+
+ // Scale back the view.
+ SGSmokeScreenAnimation *animation1 = [[SGSmokeScreenAnimation alloc] initWithSmokeScreenView:smokeScreenViewController];
+ animation1.duration = 0.2f;
+ animation1.delay = 0.0f;
+ animation1.curve = UIViewAnimationCurveLinear;
+ animation1.animations = ^(SGSmokeScreenViewController *smokeScreen){
+ [smokeScreenViewController.view addSubview:screenshot];
+
+ screenshot.transform = CGAffineTransformMakeScale(0.9, 0.9);
+ };
+
+ // Convert it to blue
+ UIView *blueView = [[UIView alloc] initWithFrame:screenshot.bounds];
+ blueView.backgroundColor = [UIColor blueColor];
+ blueView.alpha = 0.0f;
+ blueView.transform = CGAffineTransformMakeScale(0.9, 0.9);
+ [smokeScreenViewController.view insertSubview:blueView aboveSubview:screenshot];
+
+
+ SGSmokeScreenAnimation *animation2 = [[SGSmokeScreenAnimation alloc] initWithSmokeScreenView:smokeScreenViewController];
+ animation2.duration = 0.2f;
+ animation2.delay = 0.0f;
+ animation2.curve = UIViewAnimationCurveLinear;
+ animation2.animations = ^(SGSmokeScreenViewController *smokeScreen) {
+ screenshot.alpha = 0.0f;
+ blueView.alpha = 1.0f;
+
+ blueView.transform = CGAffineTransformMakeScale(1.0, 1.0);
+ };
+
+
+ // Zoom it back in.
+
+ smokeScreenViewController.animations = @[animation1, animation2];
+
+ [smokeScreenViewController performTransition];
+}
+
+- (void)didReceiveMemoryWarning
+{
+ [super didReceiveMemoryWarning];
+ // Dispose of any resources that can be recreated.
+}
+
+@end
View
13 SGSmokeScreenSample/SGSecondViewController.h
@@ -0,0 +1,13 @@
+//
+// SGSecondViewController.h
+// SGSmokeScreenSample
+//
+// Created by Justin Williams on 7/12/13.
+// Copyright (c) 2013 Second Gear. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface SGSecondViewController : UIViewController
+
+@end
View
39 SGSmokeScreenSample/SGSecondViewController.m
@@ -0,0 +1,39 @@
+//
+// SGSecondViewController.m
+// SGSmokeScreenSample
+//
+// Created by Justin Williams on 7/12/13.
+// Copyright (c) 2013 Second Gear. All rights reserved.
+//
+
+#import "SGSecondViewController.h"
+
+@interface SGSecondViewController ()
+
+@end
+
+@implementation SGSecondViewController
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ // Custom initialization
+ }
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ self.title = NSLocalizedString(@"Second", @"");
+ self.view.backgroundColor = [UIColor blueColor];
+}
+
+- (void)didReceiveMemoryWarning
+{
+ [super didReceiveMemoryWarning];
+ // Dispose of any resources that can be recreated.
+}
+
+@end
View
2 SGSmokeScreenSample/SGSmokeScreenSample-Info.plist
@@ -31,8 +31,6 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
- <string>UIInterfaceOrientationLandscapeLeft</string>
- <string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
View
2 SGSmokeScreenViewController/SGSmokeScreenViewController.m
@@ -96,8 +96,6 @@ - (void)unwindTransition
[self.destinationViewController dismissViewControllerAnimated:NO completion:nil];
}
-
-
- (void)incrementUseCount
{
self.useCount++;

0 comments on commit a7f737d

Please sign in to comment.