diff --git a/ChangingBackground.xcodeproj/project.pbxproj b/ChangingBackground.xcodeproj/project.pbxproj index 2e16be1..cc44438 100644 --- a/ChangingBackground.xcodeproj/project.pbxproj +++ b/ChangingBackground.xcodeproj/project.pbxproj @@ -24,6 +24,8 @@ 001809EC171C6764002D3E93 /* blue@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 001809E8171C6764002D3E93 /* blue@2x.png */; }; 001809ED171C6764002D3E93 /* green.png in Resources */ = {isa = PBXBuildFile; fileRef = 001809E9171C6764002D3E93 /* green.png */; }; 001809EE171C6764002D3E93 /* green@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 001809EA171C6764002D3E93 /* green@2x.png */; }; + 6458B71718230A4E0079E60D /* UINavigationController+Retro.m in Sources */ = {isa = PBXBuildFile; fileRef = 6458B71618230A4E0079E60D /* UINavigationController+Retro.m */; }; + 647617291822C12B002D52E5 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647617281822C12B002D52E5 /* QuartzCore.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -50,6 +52,9 @@ 001809E8171C6764002D3E93 /* blue@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "blue@2x.png"; sourceTree = ""; }; 001809E9171C6764002D3E93 /* green.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = green.png; sourceTree = ""; }; 001809EA171C6764002D3E93 /* green@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "green@2x.png"; sourceTree = ""; }; + 6458B71518230A4E0079E60D /* UINavigationController+Retro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UINavigationController+Retro.h"; sourceTree = ""; }; + 6458B71618230A4E0079E60D /* UINavigationController+Retro.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UINavigationController+Retro.m"; sourceTree = ""; }; + 647617281822C12B002D52E5 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -57,6 +62,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 647617291822C12B002D52E5 /* QuartzCore.framework in Frameworks */, 001809B9171C637E002D3E93 /* UIKit.framework in Frameworks */, 001809BB171C637E002D3E93 /* Foundation.framework in Frameworks */, 001809BD171C637E002D3E93 /* CoreGraphics.framework in Frameworks */, @@ -70,6 +76,7 @@ isa = PBXGroup; children = ( 001809BE171C637E002D3E93 /* ChangingBackground */, + 6458B70F182305EA0079E60D /* vendor */, 001809B7171C637E002D3E93 /* Frameworks */, 001809B6171C637E002D3E93 /* Products */, ); @@ -86,6 +93,7 @@ 001809B7171C637E002D3E93 /* Frameworks */ = { isa = PBXGroup; children = ( + 647617281822C12B002D52E5 /* QuartzCore.framework */, 001809B8171C637E002D3E93 /* UIKit.framework */, 001809BA171C637E002D3E93 /* Foundation.framework */, 001809BC171C637E002D3E93 /* CoreGraphics.framework */, @@ -167,6 +175,16 @@ name = BackgroundImages; sourceTree = ""; }; + 6458B70F182305EA0079E60D /* vendor */ = { + isa = PBXGroup; + children = ( + 6458B71518230A4E0079E60D /* UINavigationController+Retro.h */, + 6458B71618230A4E0079E60D /* UINavigationController+Retro.m */, + ); + name = vendor; + path = ChangingBackground; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -238,6 +256,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 6458B71718230A4E0079E60D /* UINavigationController+Retro.m in Sources */, 001809C5171C637E002D3E93 /* main.m in Sources */, 001809C9171C637E002D3E93 /* AppDelegate.m in Sources */, 001809D9171C6448002D3E93 /* FirstViewController.m in Sources */, @@ -284,9 +303,9 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; + SDKROOT = iphoneos7.0; }; name = Debug; }; @@ -308,9 +327,9 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; - SDKROOT = iphoneos; + SDKROOT = iphoneos7.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -321,6 +340,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "ChangingBackground/ChangingBackground-Prefix.pch"; INFOPLIST_FILE = "ChangingBackground/ChangingBackground-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -332,6 +352,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "ChangingBackground/ChangingBackground-Prefix.pch"; INFOPLIST_FILE = "ChangingBackground/ChangingBackground-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -356,6 +377,7 @@ 001809D4171C637E002D3E93 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/ChangingBackground/AppDelegate.m b/ChangingBackground/AppDelegate.m index 9538cc1..9f9b9f2 100644 --- a/ChangingBackground/AppDelegate.m +++ b/ChangingBackground/AppDelegate.m @@ -14,11 +14,22 @@ @interface AppDelegate () { } @end - @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { window = [UIWindow.alloc initWithFrame:UIScreen.mainScreen.bounds]; + + UIImage* blueBackgroundImage = [UIImage imageNamed:@"blue.png"]; + UIImageView* blueBackground = [[UIImageView alloc] initWithImage:blueBackgroundImage]; + blueBackground.alpha = 0.8; + + UIImage* greenBackgroundImage = [UIImage imageNamed:@"green.png"]; + UIImageView* greenBackground = [[UIImageView alloc] initWithImage:greenBackgroundImage]; + greenBackground.alpha = 0.2; + + [window addSubview:blueBackground]; + [window addSubview:greenBackground]; + [window makeKeyAndVisible]; FirstViewController *firstViewController = FirstViewController.new; diff --git a/ChangingBackground/ChangingBackground-Info.plist b/ChangingBackground/ChangingBackground-Info.plist index bab2011..fdb2721 100644 --- a/ChangingBackground/ChangingBackground-Info.plist +++ b/ChangingBackground/ChangingBackground-Info.plist @@ -2,6 +2,12 @@ + UIViewControllerBasedStatusBarAppearance + + UIStatusBarHidden + + UIStatusBarStyle + UIStatusBarStyleLightContent CFBundleDevelopmentRegion en CFBundleDisplayName diff --git a/ChangingBackground/FirstViewController.m b/ChangingBackground/FirstViewController.m index 8aedb68..324d690 100644 --- a/ChangingBackground/FirstViewController.m +++ b/ChangingBackground/FirstViewController.m @@ -6,8 +6,11 @@ // Copyright (c) 2013 Ora Interactive. All rights reserved. // +#import + #import "FirstViewController.h" #import "SecondViewController.h" +#import "UINavigationController+Retro.h" @interface FirstViewController () @@ -17,7 +20,29 @@ @implementation FirstViewController - (IBAction)goForwardButtonPressed { SecondViewController *secondViewController = SecondViewController.new; - [self.navigationController pushViewController:secondViewController animated:YES]; + [self.navigationController pushViewControllerRetro:secondViewController]; +} + +- (void) viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = [UIColor clearColor]; +} + +- (void) viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + + UIWindow* window = [UIApplication sharedApplication].keyWindow; + + //(WW) UIImageView window subviews added in AppDelegate + UIImageView* blueBackground = [[window subviews] objectAtIndex:0]; + UIImageView* greenBackground = [[window subviews] objectAtIndex:1]; + + if (blueBackground.alpha < 0.8) { + [UIView animateWithDuration:1.5 delay:0.3 options:UIViewAnimationOptionTransitionNone animations:^{ + blueBackground.alpha = 0.8; + greenBackground.alpha = 0.2; + } completion:NULL]; + } } @end diff --git a/ChangingBackground/FirstViewController.xib b/ChangingBackground/FirstViewController.xib index 0dd58c2..637e01d 100644 --- a/ChangingBackground/FirstViewController.xib +++ b/ChangingBackground/FirstViewController.xib @@ -1,217 +1,41 @@ - - - - 1552 - 12C3006 - 3084 - 1187.34 - 625.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 2083 - - - IBProxyObject - IBUIButton - IBUILabel - IBUIView - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - - - 292 - {{77, 115}, {166, 21}} - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - Home View Controller - - 1 - MCAwIDAAA - darkTextColor - - - 0 - - 1 - 17 - - - Helvetica - 17 - 16 - - NO - - - - 292 - {{102, 180}, {109, 44}} - - _NS:9 - NO - IBCocoaTouchFramework - 0 - 0 - 1 - Go Forward - - 3 - MQA - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - 3 - MC41AA - - - 2 - 15 - - - Helvetica-Bold - 15 - 16 - - - - {{0, 20}, {320, 548}} - - - 3 - MQA - - 2 - - - - - IBUIScreenMetrics - - YES - - - - - - {320, 568} - {568, 320} - - - IBCocoaTouchFramework - Retina 4 Full Screen - 2 - - IBCocoaTouchFramework - - - - - - - view - - - - 3 - - - - goForwardButtonPressed - - - 7 - - 8 - - - - - - 0 - - - - - - 1 - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 4 - - - - - 7 - - - - - - - FirstViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - 8 - - - 0 - IBCocoaTouchFramework - YES - 3 - 2083 - - + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ChangingBackground/SecondViewController.m b/ChangingBackground/SecondViewController.m index 028f811..61cedac 100644 --- a/ChangingBackground/SecondViewController.m +++ b/ChangingBackground/SecondViewController.m @@ -7,12 +7,33 @@ // #import "SecondViewController.h" +#import "UINavigationController+Retro.h" @implementation SecondViewController - (IBAction)goBackButtonPressed { - [self.navigationController popViewControllerAnimated:YES]; + [self.navigationController popViewControllerRetro]; +} + +- (void) viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = [UIColor clearColor]; +} + +- (void) viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + + UIWindow* window = [UIApplication sharedApplication].keyWindow; + + //(WW) UIImageView window subviews added in AppDelegate + UIImageView* blueBackground = [[window subviews] objectAtIndex:0]; + UIImageView* greenBackground = [[window subviews] objectAtIndex:1]; + + [UIView animateWithDuration:1.5 delay:0.3 options:UIViewAnimationOptionTransitionNone animations:^{ + blueBackground.alpha = 0.2; + greenBackground.alpha = 0.8; + } completion:NULL]; } @end diff --git a/ChangingBackground/SecondViewController.xib b/ChangingBackground/SecondViewController.xib index d603949..9154eac 100644 --- a/ChangingBackground/SecondViewController.xib +++ b/ChangingBackground/SecondViewController.xib @@ -1,243 +1,39 @@ - - - - 1552 - 12C3006 - 3084 - 1187.34 - 625.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 2083 - - - IBProxyObject - IBUIButton - IBUILabel - IBUIView - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - - - 292 - {{71, 118}, {209, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - Second View Controller - - 1 - MCAwIDAAA - darkTextColor - - - 0 - - 1 - 17 - - - Helvetica - 17 - 16 - - NO - - - - 292 - {{118, 178}, {85, 44}} - - - _NS:9 - NO - IBCocoaTouchFramework - 0 - 0 - 1 - Go Back - - 3 - MQA - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - 3 - MC41AA - - - 2 - 15 - - - Helvetica-Bold - 15 - 16 - - - - {{0, 20}, {320, 548}} - - - - - 3 - MQA - - 2 - - - - - IBUIScreenMetrics - - YES - - - - - - {320, 568} - {568, 320} - - - IBCocoaTouchFramework - Retina 4 Full Screen - 2 - - IBCocoaTouchFramework - - - - - - - view - - - - 3 - - - - goBackButtonPressed - - - 7 - - 10 - - - - - - 0 - - - - - - 1 - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 4 - - - - - 7 - - - - - - - SecondViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - 10 - - - - - SecondViewController - UIViewController - - goBackButtonPressed - id - - - goBackButtonPressed - - goBackButtonPressed - id - - - - IBProjectSource - ./Classes/SecondViewController.h - - - - - 0 - IBCocoaTouchFramework - YES - 3 - 2083 - - + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ChangingBackground/UINavigationController+Retro.h b/ChangingBackground/UINavigationController+Retro.h new file mode 100644 index 0000000..87d081e --- /dev/null +++ b/ChangingBackground/UINavigationController+Retro.h @@ -0,0 +1,19 @@ +// +// UINavigationController+Retro.h +// ChangingBackground +// +// Created by Weien Wang on 10/31/13. +// Copyright (c) 2013 Ora Interactive. All rights reserved. +// + +#import + +@interface UINavigationController (Retro) + +//added to get around annoying iOS 7-style navigation animation +//thanks to http://stackoverflow.com/a/18882232/2284713 + +- (void)pushViewControllerRetro:(UIViewController *)viewController; +- (void)popViewControllerRetro; + +@end diff --git a/ChangingBackground/UINavigationController+Retro.m b/ChangingBackground/UINavigationController+Retro.m new file mode 100644 index 0000000..279773d --- /dev/null +++ b/ChangingBackground/UINavigationController+Retro.m @@ -0,0 +1,35 @@ +// +// UINavigationController+Retro.m +// ChangingBackground +// +// Created by Weien Wang on 10/31/13. +// Copyright (c) 2013 Ora Interactive. All rights reserved. +// + +#import "UINavigationController+Retro.h" + +@implementation UINavigationController (Retro) + +- (void)pushViewControllerRetro:(UIViewController *)viewController { + CATransition *transition = [CATransition animation]; + transition.duration = 0.25; + transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + transition.type = kCATransitionPush; + transition.subtype = kCATransitionFromRight; + [self.view.layer addAnimation:transition forKey:nil]; + + [self pushViewController:viewController animated:NO]; +} + +- (void)popViewControllerRetro { + CATransition *transition = [CATransition animation]; + transition.duration = 0.25; + transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + transition.type = kCATransitionPush; + transition.subtype = kCATransitionFromLeft; + [self.view.layer addAnimation:transition forKey:nil]; + + [self popViewControllerAnimated:NO]; +} + +@end