From b4e7679ed1e660c9398a1556a78a86f471879e13 Mon Sep 17 00:00:00 2001 From: Wojciech Nagrodzki <278594+wnagrodzki@users.noreply.github.com> Date: Thu, 11 Apr 2013 17:31:22 +0200 Subject: [PATCH] Implement view controller containment with automatic and manual appearance callback forwarding. --- .../project.pbxproj | 38 + .../VCCAutomaticCallbacksViewController.h | 2 + .../VCCAutomaticCallbacksViewController.m | 103 ++- .../VCCAutomaticCallbacksViewController.xib | 167 ++++- .../VCCManualCallbacksViewController.h | 2 + .../VCCManualCallbacksViewController.m | 111 ++- .../VCCManualCallbacksViewController.xib | 682 +++++++++++++++++- .../VCCViewController.m | 15 + .../ViewControllers/VCCBlueViewController.h | 13 + .../ViewControllers/VCCBlueViewController.m | 60 ++ .../ViewControllers/VCCBlueViewController.xib | 236 ++++++ .../ViewControllers/VCCGreenViewController.h | 13 + .../ViewControllers/VCCGreenViewController.m | 60 ++ .../VCCGreenViewController.xib | 234 ++++++ .../ViewControllers/VCCRedViewController.h | 13 + .../ViewControllers/VCCRedViewController.m | 60 ++ .../ViewControllers/VCCRedViewController.xib | 236 ++++++ 17 files changed, 2015 insertions(+), 30 deletions(-) create mode 100644 ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCBlueViewController.h create mode 100644 ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCBlueViewController.m create mode 100644 ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCBlueViewController.xib create mode 100644 ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCGreenViewController.h create mode 100644 ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCGreenViewController.m create mode 100644 ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCGreenViewController.xib create mode 100644 ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCRedViewController.h create mode 100644 ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCRedViewController.m create mode 100644 ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCRedViewController.xib diff --git a/ViewControllerContainment/ViewControllerContainment.xcodeproj/project.pbxproj b/ViewControllerContainment/ViewControllerContainment.xcodeproj/project.pbxproj index 483a226..56fa1cc 100644 --- a/ViewControllerContainment/ViewControllerContainment.xcodeproj/project.pbxproj +++ b/ViewControllerContainment/ViewControllerContainment.xcodeproj/project.pbxproj @@ -22,6 +22,12 @@ 2E9F4BE916D405AD000F1A04 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2E9F4BE816D405AD000F1A04 /* Default-568h@2x.png */; }; 2E9F4BEC16D405AD000F1A04 /* VCCViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E9F4BEB16D405AD000F1A04 /* VCCViewController.m */; }; 2E9F4BEF16D405AD000F1A04 /* VCCViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2E9F4BED16D405AD000F1A04 /* VCCViewController.xib */; }; + 2ED0C5E21716E37E00FB7DA2 /* VCCRedViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2ED0C5E01716E37E00FB7DA2 /* VCCRedViewController.m */; }; + 2ED0C5E31716E37E00FB7DA2 /* VCCRedViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2ED0C5E11716E37E00FB7DA2 /* VCCRedViewController.xib */; }; + 2ED0C5E71716E3CF00FB7DA2 /* VCCGreenViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2ED0C5E51716E3CF00FB7DA2 /* VCCGreenViewController.m */; }; + 2ED0C5E81716E3CF00FB7DA2 /* VCCGreenViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2ED0C5E61716E3CF00FB7DA2 /* VCCGreenViewController.xib */; }; + 2ED0C5EC1716E3EB00FB7DA2 /* VCCBlueViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2ED0C5EA1716E3EB00FB7DA2 /* VCCBlueViewController.m */; }; + 2ED0C5ED1716E3EB00FB7DA2 /* VCCBlueViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2ED0C5EB1716E3EB00FB7DA2 /* VCCBlueViewController.xib */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -48,6 +54,15 @@ 2E9F4BEA16D405AD000F1A04 /* VCCViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VCCViewController.h; sourceTree = ""; }; 2E9F4BEB16D405AD000F1A04 /* VCCViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VCCViewController.m; sourceTree = ""; }; 2E9F4BEE16D405AD000F1A04 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/VCCViewController.xib; sourceTree = ""; }; + 2ED0C5DF1716E37E00FB7DA2 /* VCCRedViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VCCRedViewController.h; sourceTree = ""; }; + 2ED0C5E01716E37E00FB7DA2 /* VCCRedViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VCCRedViewController.m; sourceTree = ""; }; + 2ED0C5E11716E37E00FB7DA2 /* VCCRedViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = VCCRedViewController.xib; sourceTree = ""; }; + 2ED0C5E41716E3CF00FB7DA2 /* VCCGreenViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VCCGreenViewController.h; sourceTree = ""; }; + 2ED0C5E51716E3CF00FB7DA2 /* VCCGreenViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VCCGreenViewController.m; sourceTree = ""; }; + 2ED0C5E61716E3CF00FB7DA2 /* VCCGreenViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = VCCGreenViewController.xib; sourceTree = ""; }; + 2ED0C5E91716E3EB00FB7DA2 /* VCCBlueViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VCCBlueViewController.h; sourceTree = ""; }; + 2ED0C5EA1716E3EB00FB7DA2 /* VCCBlueViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VCCBlueViewController.m; sourceTree = ""; }; + 2ED0C5EB1716E3EB00FB7DA2 /* VCCBlueViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = VCCBlueViewController.xib; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -107,6 +122,7 @@ 2E5F159A16DBFE19003A87FA /* VCCManualCallbacksViewController.h */, 2E5F159B16DBFE19003A87FA /* VCCManualCallbacksViewController.m */, 2E5F159C16DBFE19003A87FA /* VCCManualCallbacksViewController.xib */, + 2ED0C5DE1716E36300FB7DA2 /* ViewControllers */, ); path = ViewControllerContainment; sourceTree = ""; @@ -125,6 +141,22 @@ name = "Supporting Files"; sourceTree = ""; }; + 2ED0C5DE1716E36300FB7DA2 /* ViewControllers */ = { + isa = PBXGroup; + children = ( + 2ED0C5DF1716E37E00FB7DA2 /* VCCRedViewController.h */, + 2ED0C5E01716E37E00FB7DA2 /* VCCRedViewController.m */, + 2ED0C5E11716E37E00FB7DA2 /* VCCRedViewController.xib */, + 2ED0C5E41716E3CF00FB7DA2 /* VCCGreenViewController.h */, + 2ED0C5E51716E3CF00FB7DA2 /* VCCGreenViewController.m */, + 2ED0C5E61716E3CF00FB7DA2 /* VCCGreenViewController.xib */, + 2ED0C5E91716E3EB00FB7DA2 /* VCCBlueViewController.h */, + 2ED0C5EA1716E3EB00FB7DA2 /* VCCBlueViewController.m */, + 2ED0C5EB1716E3EB00FB7DA2 /* VCCBlueViewController.xib */, + ); + path = ViewControllers; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -184,6 +216,9 @@ 2E9F4BEF16D405AD000F1A04 /* VCCViewController.xib in Resources */, 2E5F159916DBFE04003A87FA /* VCCAutomaticCallbacksViewController.xib in Resources */, 2E5F159E16DBFE19003A87FA /* VCCManualCallbacksViewController.xib in Resources */, + 2ED0C5E31716E37E00FB7DA2 /* VCCRedViewController.xib in Resources */, + 2ED0C5E81716E3CF00FB7DA2 /* VCCGreenViewController.xib in Resources */, + 2ED0C5ED1716E3EB00FB7DA2 /* VCCBlueViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -199,6 +234,9 @@ 2E9F4BEC16D405AD000F1A04 /* VCCViewController.m in Sources */, 2E5F159816DBFE04003A87FA /* VCCAutomaticCallbacksViewController.m in Sources */, 2E5F159D16DBFE19003A87FA /* VCCManualCallbacksViewController.m in Sources */, + 2ED0C5E21716E37E00FB7DA2 /* VCCRedViewController.m in Sources */, + 2ED0C5E71716E3CF00FB7DA2 /* VCCGreenViewController.m in Sources */, + 2ED0C5EC1716E3EB00FB7DA2 /* VCCBlueViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/ViewControllerContainment/ViewControllerContainment/VCCAutomaticCallbacksViewController.h b/ViewControllerContainment/ViewControllerContainment/VCCAutomaticCallbacksViewController.h index 121e3b5..d318229 100644 --- a/ViewControllerContainment/ViewControllerContainment/VCCAutomaticCallbacksViewController.h +++ b/ViewControllerContainment/ViewControllerContainment/VCCAutomaticCallbacksViewController.h @@ -10,4 +10,6 @@ @interface VCCAutomaticCallbacksViewController : UIViewController +@property (strong, nonatomic) NSArray * viewControllers; + @end diff --git a/ViewControllerContainment/ViewControllerContainment/VCCAutomaticCallbacksViewController.m b/ViewControllerContainment/ViewControllerContainment/VCCAutomaticCallbacksViewController.m index 1f76c11..207600f 100644 --- a/ViewControllerContainment/ViewControllerContainment/VCCAutomaticCallbacksViewController.m +++ b/ViewControllerContainment/ViewControllerContainment/VCCAutomaticCallbacksViewController.m @@ -8,16 +8,59 @@ #import "VCCAutomaticCallbacksViewController.h" -@interface VCCAutomaticCallbacksViewController () + +@interface VCCAutomaticCallbacksViewController () { + UIViewController * _displayedController; +} + +@property (weak, nonatomic) IBOutlet UIView *containerView; @end + @implementation VCCAutomaticCallbacksViewController #pragma mark - Public Properties + +- (void)setViewControllers:(NSArray *)viewControllers +{ + _viewControllers = viewControllers; + + if (self.isViewLoaded == NO) + return; + + if (self.viewControllers.count == 0) + return; + + [self displayViewController:viewControllers[0]]; +} + #pragma mark - Class Methods #pragma mark - Instance Methods #pragma mark - IBActions + +- (IBAction)previousButtonTapped:(id)sender +{ + NSUInteger index = [self.viewControllers indexOfObject:_displayedController]; + if (index == 0) + return; + + UIViewController * previousViewController = self.viewControllers[index - 1]; + [self cycleFromViewController:_displayedController toViewController:previousViewController forward:NO]; + _displayedController = previousViewController; +} + +- (IBAction)nextButtonTapped:(id)sender +{ + NSUInteger index = [self.viewControllers indexOfObject:_displayedController]; + if (index == self.viewControllers.count - 1) + return; + + UIViewController * nextViewController = self.viewControllers[index + 1]; + [self cycleFromViewController:_displayedController toViewController:nextViewController forward:YES]; + _displayedController = nextViewController; +} + #pragma mark - Overriden - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil @@ -29,34 +72,84 @@ return self; } +- (void)viewDidLoad +{ + [super viewDidLoad]; + + if (self.viewControllers.count) + [self displayViewController:self.viewControllers[0]]; +} + #pragma mark - Overriden (Appearanca Callbacks) - (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; NGLogMessage(); + [super viewWillAppear:animated]; } - (void)viewDidAppear:(BOOL)animated { - [super viewDidAppear:animated]; NGLogMessage(); + [super viewDidAppear:animated]; } - (void)viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; NGLogMessage(); + [super viewWillDisappear:animated]; } - (void)viewDidDisappear:(BOOL)animated { - [super viewDidDisappear:animated]; NGLogMessage(); + [super viewDidDisappear:animated]; } #pragma mark - Private Properties #pragma mark - Private Methods + +- (void)cycleFromViewController:(UIViewController *)fromViewController toViewController:(UIViewController *)toViewController forward:(BOOL)forward +{ + [fromViewController willMoveToParentViewController:nil]; + [self addChildViewController:toViewController]; + + CGRect frame = self.containerView.bounds; + frame.origin.x = forward ? frame.size.width : -frame.size.width; + toViewController.view.frame = frame; + + [self transitionFromViewController:fromViewController + toViewController:toViewController + duration:0.3 + options:UIViewAnimationOptionCurveEaseInOut + animations:^{ + CGRect frame = self.containerView.bounds; + frame.origin.x = forward ? -frame.size.width : frame.size.width; + fromViewController.view.frame = frame; + + toViewController.view.frame = self.containerView.bounds; + } + completion:^(BOOL finished) { + [toViewController didMoveToParentViewController:self]; + [fromViewController removeFromParentViewController]; + }]; + +} + +- (void)displayViewController:(UIViewController *)controller +{ + [_displayedController willMoveToParentViewController:nil]; + [_displayedController.view removeFromSuperview]; + [_displayedController removeFromParentViewController]; + + _displayedController = controller; + + [self addChildViewController:controller]; + controller.view.frame = self.containerView.bounds; + [self.containerView addSubview:controller.view]; + [controller didMoveToParentViewController:self]; +} + #pragma mark - OtherPerfectClassDelegate #pragma mark - Notifications diff --git a/ViewControllerContainment/ViewControllerContainment/VCCAutomaticCallbacksViewController.xib b/ViewControllerContainment/ViewControllerContainment/VCCAutomaticCallbacksViewController.xib index b94d4e5..b3672e8 100644 --- a/ViewControllerContainment/ViewControllerContainment/VCCAutomaticCallbacksViewController.xib +++ b/ViewControllerContainment/ViewControllerContainment/VCCAutomaticCallbacksViewController.xib @@ -2,16 +2,17 @@ 1552 - 12C3006 + 12D78 3084 - 1187.34 - 625.00 + 1187.37 + 626.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 2083 IBProxyObject + IBUIButton IBUIView @@ -33,15 +34,92 @@ 274 + + + + 274 + {{20, 20}, {280, 465}} + + + + _NS:9 + + 3 + MQA + + 2 + + + YES + IBCocoaTouchFramework + + + + 268 + {{0, 505}, {160, 44}} + + + + _NS:9 + NO + IBCocoaTouchFramework + 0 + 0 + 1 + Previous + + 3 + MQA + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + 3 + MC41AA + + + 2 + 15 + + + Helvetica-Bold + 15 + 16 + + + + + 265 + {{160, 505}, {160, 44}} + + + _NS:9 + NO + IBCocoaTouchFramework + 0 + 0 + 1 + Next + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + + + {{0, 20}, {320, 548}} + 3 MQA - - 2 - + @@ -74,6 +152,32 @@ 3 + + + containerView + + + + 17 + + + + previousButtonTapped: + + + 7 + + 18 + + + + nextButtonTapped: + + + 7 + + 19 + @@ -86,6 +190,11 @@ 1 + + + + + @@ -99,6 +208,21 @@ + + 4 + + + + + 15 + + + + + 16 + + + @@ -107,18 +231,46 @@ UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 3 + 19 VCCAutomaticCallbacksViewController UIViewController + + id + id + + + + nextButtonTapped: + id + + + previousButtonTapped: + id + + + + containerView + UIView + + + containerView + + containerView + UIView + + IBProjectSource ./Classes/VCCAutomaticCallbacksViewController.h @@ -130,7 +282,6 @@ IBCocoaTouchFramework YES 3 - YES 2083 diff --git a/ViewControllerContainment/ViewControllerContainment/VCCManualCallbacksViewController.h b/ViewControllerContainment/ViewControllerContainment/VCCManualCallbacksViewController.h index e24aaa4..fa610ac 100644 --- a/ViewControllerContainment/ViewControllerContainment/VCCManualCallbacksViewController.h +++ b/ViewControllerContainment/ViewControllerContainment/VCCManualCallbacksViewController.h @@ -10,4 +10,6 @@ @interface VCCManualCallbacksViewController : UIViewController +@property (strong, nonatomic) NSArray * viewControllers; + @end diff --git a/ViewControllerContainment/ViewControllerContainment/VCCManualCallbacksViewController.m b/ViewControllerContainment/ViewControllerContainment/VCCManualCallbacksViewController.m index 2ec1ab9..37e9675 100644 --- a/ViewControllerContainment/ViewControllerContainment/VCCManualCallbacksViewController.m +++ b/ViewControllerContainment/ViewControllerContainment/VCCManualCallbacksViewController.m @@ -8,16 +8,60 @@ #import "VCCManualCallbacksViewController.h" -@interface VCCManualCallbacksViewController () + +@interface VCCManualCallbacksViewController () { + UIViewController * _displayedController; +} + +@property (weak, nonatomic) IBOutlet UIView *containerView; @end + @implementation VCCManualCallbacksViewController #pragma mark - Public Properties + +- (void)setViewControllers:(NSArray *)viewControllers +{ + _viewControllers = viewControllers; + + if (self.isViewLoaded == NO) + return; + + NSParameterAssert(viewControllers.count == 3); +} + #pragma mark - Class Methods #pragma mark - Instance Methods #pragma mark - IBActions + +- (IBAction)hideButtonTapped:(id)sender +{ + [self hideDisplayedViewController]; +} + +- (IBAction)redButtonTapped:(id)sender +{ + UIViewController * controller = self.viewControllers[0]; + [self cycleFromViewController:_displayedController toViewController:controller]; + _displayedController = controller; +} + +- (IBAction)greenButtonTapped:(id)sender +{ + UIViewController * controller = self.viewControllers[1]; + [self cycleFromViewController:_displayedController toViewController:controller]; + _displayedController = controller; +} + +- (IBAction)blueButtonTapped:(id)sender +{ + UIViewController * controller = self.viewControllers[2]; + [self cycleFromViewController:_displayedController toViewController:controller]; + _displayedController = controller; +} + #pragma mark - Overriden - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil @@ -29,30 +73,39 @@ return self; } +- (BOOL)shouldAutomaticallyForwardAppearanceMethods +{ + return NO; +} + #pragma mark - Overriden (Appearance Callbacks) - (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; NGLogMessage(); + [super viewWillAppear:animated]; + [_displayedController beginAppearanceTransition:YES animated:animated]; } - (void)viewDidAppear:(BOOL)animated { - [super viewDidAppear:animated]; NGLogMessage(); + [super viewDidAppear:animated]; + [_displayedController endAppearanceTransition]; } - (void)viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; NGLogMessage(); + [super viewWillDisappear:animated]; + [_displayedController beginAppearanceTransition:NO animated:animated]; } - (void)viewDidDisappear:(BOOL)animated { - [super viewDidDisappear:animated]; NGLogMessage(); + [super viewDidDisappear:animated]; + [_displayedController endAppearanceTransition]; } #pragma mark - Overriden (Rotation Callbacks) @@ -74,6 +127,54 @@ #pragma mark - Private Properties #pragma mark - Private Methods + +- (void)cycleFromViewController:(UIViewController *)fromViewController toViewController:(UIViewController *)toViewController +{ + [fromViewController willMoveToParentViewController:nil]; + [fromViewController beginAppearanceTransition:NO animated:YES]; + + [self addChildViewController:toViewController]; + [toViewController beginAppearanceTransition:YES animated:YES]; + toViewController.view.frame = self.containerView.bounds; + toViewController.view.alpha = 0; + [self.containerView addSubview:toViewController.view]; + + [UIView animateWithDuration:0.3 + animations:^{ + fromViewController.view.alpha = 0; + toViewController.view.alpha = 1; + } + completion:^(BOOL finished) { + [toViewController didMoveToParentViewController:self]; + [toViewController endAppearanceTransition]; + + [fromViewController.view removeFromSuperview]; + [fromViewController removeFromParentViewController]; + [fromViewController endAppearanceTransition]; + }]; +} + +- (void)hideDisplayedViewController +{ + if (_displayedController == nil) + return; + + [_displayedController willMoveToParentViewController:nil]; + [_displayedController beginAppearanceTransition:NO animated:YES]; + + [UIView animateWithDuration:0.3 + animations:^{ + _displayedController.view.alpha = 0; + } + completion:^(BOOL finished) { + [_displayedController.view removeFromSuperview]; + [_displayedController removeFromParentViewController]; + [_displayedController endAppearanceTransition]; + + _displayedController = nil; + }]; +} + #pragma mark - OtherPerfectClassDelegate #pragma mark - Notifications diff --git a/ViewControllerContainment/ViewControllerContainment/VCCManualCallbacksViewController.xib b/ViewControllerContainment/ViewControllerContainment/VCCManualCallbacksViewController.xib index 029c1cc..d634059 100644 --- a/ViewControllerContainment/ViewControllerContainment/VCCManualCallbacksViewController.xib +++ b/ViewControllerContainment/ViewControllerContainment/VCCManualCallbacksViewController.xib @@ -1,17 +1,19 @@ - 1536 - 12A269 - 2835 - 1187 - 624.00 + 1552 + 12D78 + 3084 + 1187.37 + 626.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 1919 + 2083 + IBNSLayoutConstraint IBProxyObject + IBUIButton IBUIView @@ -33,16 +35,137 @@ 274 + + + + 274 + {{20, 20}, {280, 394}} + + + + _NS:9 + + 3 + MQA + + 2 + + + IBCocoaTouchFramework + + + + 292 + {{20, 485}, {90, 44}} + + + + _NS:9 + NO + IBCocoaTouchFramework + 0 + 0 + 1 + Red + + 3 + MQA + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + 3 + MC41AA + + + 2 + 15 + + + Helvetica-Bold + 15 + 16 + + + + + 292 + {{210, 485}, {90, 44}} + + + _NS:9 + NO + IBCocoaTouchFramework + 0 + 0 + 1 + Blue + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + + + + + 292 + {{115, 485}, {90, 44}} + + + + _NS:9 + NO + IBCocoaTouchFramework + 0 + 0 + 1 + Green + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + + + + + 292 + {{20, 434}, {280, 44}} + + + + _NS:9 + NO + IBCocoaTouchFramework + 0 + 0 + 1 + Hide + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + + + {{0, 20}, {320, 548}} - + 3 MQA - - 2 - + @@ -75,6 +198,50 @@ 3 + + + containerView + + + + 60 + + + + redButtonTapped: + + + 7 + + 57 + + + + blueButtonTapped: + + + 7 + + 59 + + + + greenButtonTapped: + + + 7 + + 58 + + + + hideButtonTapped: + + + 7 + + 56 + @@ -87,6 +254,237 @@ 1 + + + + + + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 11 + 0 + + 11 + 1 + + 0.0 + + 1000 + + 9 + 40 + 2 + + + + 11 + 0 + + 11 + 1 + + 0.0 + + 1000 + + 9 + 40 + 2 + + + + 4 + 0 + + 4 + 1 + + 20 + + 1000 + + 9 + 40 + 3 + + + + 11 + 0 + + 11 + 1 + + 0.0 + + 1000 + + 9 + 40 + 2 + + + + 5 + 0 + + 5 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 3 + 0 + + 4 + 1 + + 8 + + 1000 + + 9 + 40 + 3 + + + + 3 + 0 + + 4 + 1 + + 20 + + 1000 + + 9 + 40 + 3 + + + + 5 + 0 + + 5 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 9 + 0 + + 9 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 5 + 0 + + 5 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 3 + 0 + + 3 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + @@ -100,6 +498,171 @@ + + 4 + + + + + 9 + + + + + 7 + 0 + + 0 + 1 + + 90 + + 1000 + + 3 + 9 + 1 + + + + + + 10 + + + + + 7 + 0 + + 0 + 1 + + 90 + + 1000 + + 3 + 9 + 1 + + + + + + 11 + + + + + 7 + 0 + + 0 + 1 + + 90 + + 1000 + + 3 + 9 + 1 + + + + + + 12 + + + + + + 13 + + + + + 15 + + + + + 16 + + + + + 17 + + + + + 18 + + + + + 19 + + + + + 20 + + + + + 21 + + + + + 23 + + + + + 25 + + + + + 26 + + + + + 27 + + + + + 29 + + + + + 30 + + + + + 31 + + + + + 43 + + + + + 44 + + + @@ -108,18 +671,113 @@ UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + + + + + + + + + + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + - 3 + 60 + + NSLayoutConstraint + NSObject + + IBProjectSource + ./Classes/NSLayoutConstraint.h + + VCCManualCallbacksViewController UIViewController + + id + id + id + id + + + + blueButtonTapped: + id + + + greenButtonTapped: + id + + + hideButtonTapped: + id + + + redButtonTapped: + id + + + + containerView + UIView + + + containerView + + containerView + UIView + + IBProjectSource ./Classes/VCCManualCallbacksViewController.h @@ -132,6 +790,6 @@ YES 3 YES - 1919 + 2083 diff --git a/ViewControllerContainment/ViewControllerContainment/VCCViewController.m b/ViewControllerContainment/ViewControllerContainment/VCCViewController.m index edca89b..5eb3aca 100644 --- a/ViewControllerContainment/ViewControllerContainment/VCCViewController.m +++ b/ViewControllerContainment/ViewControllerContainment/VCCViewController.m @@ -9,6 +9,9 @@ #import "VCCViewController.h" #import "VCCAutomaticCallbacksViewController.h" #import "VCCManualCallbacksViewController.h" +#import "VCCRedViewController.h" +#import "VCCGreenViewController.h" +#import "VCCBlueViewController.h" @implementation VCCViewController @@ -21,12 +24,24 @@ - (IBAction)automaticCallbacksTapped:(id)sender { VCCAutomaticCallbacksViewController * controller = [[VCCAutomaticCallbacksViewController alloc] init]; + + VCCRedViewController * red = [[VCCRedViewController alloc] init]; + VCCGreenViewController * green = [[VCCGreenViewController alloc] init]; + VCCBlueViewController * blue = [[VCCBlueViewController alloc] init]; + controller.viewControllers = @[red, green, blue]; + [self.navigationController pushViewController:controller animated:YES]; } - (IBAction)manualCallbacksTapped:(id)sender { VCCManualCallbacksViewController * controller = [[VCCManualCallbacksViewController alloc] init]; + + VCCRedViewController * red = [[VCCRedViewController alloc] init]; + VCCGreenViewController * green = [[VCCGreenViewController alloc] init]; + VCCBlueViewController * blue = [[VCCBlueViewController alloc] init]; + controller.viewControllers = @[red, green, blue]; + [self.navigationController pushViewController:controller animated:YES]; } diff --git a/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCBlueViewController.h b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCBlueViewController.h new file mode 100644 index 0000000..feae591 --- /dev/null +++ b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCBlueViewController.h @@ -0,0 +1,13 @@ +// +// VCCBlueViewController.h +// ViewControllerContainment +// +// Created by Wojtek Nagrodzki on 11/04/2013. +// Copyright (c) 2013 Wojtek Nagrodzki. All rights reserved. +// + +#import + +@interface VCCBlueViewController : UIViewController + +@end diff --git a/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCBlueViewController.m b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCBlueViewController.m new file mode 100644 index 0000000..c5122d2 --- /dev/null +++ b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCBlueViewController.m @@ -0,0 +1,60 @@ +// +// VCCBlueViewController.m +// ViewControllerContainment +// +// Created by Wojtek Nagrodzki on 11/04/2013. +// Copyright (c) 2013 Wojtek Nagrodzki. All rights reserved. +// + +#import "VCCBlueViewController.h" + +@interface VCCBlueViewController () + +@end + +@implementation VCCBlueViewController + +#pragma mark - Overriden (Appearanca Callbacks) + +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + NGLogMessage(); +} + +- (void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; + NGLogMessage(); +} + +- (void)viewWillDisappear:(BOOL)animated +{ + [super viewWillDisappear:animated]; + NGLogMessage(); +} + +- (void)viewDidDisappear:(BOOL)animated +{ + [super viewDidDisappear:animated]; + NGLogMessage(); +} + +#pragma mark - Overriden (Rotation Callbacks) + +- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration +{ + NGLogMessage(); +} + +- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation +{ + NGLogMessage(); +} + +- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration +{ + NGLogMessage(); +} + +@end diff --git a/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCBlueViewController.xib b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCBlueViewController.xib new file mode 100644 index 0000000..caca184 --- /dev/null +++ b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCBlueViewController.xib @@ -0,0 +1,236 @@ + + + + 1552 + 12D78 + 3084 + 1187.37 + 626.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 2083 + + + IBNSLayoutConstraint + IBProxyObject + IBUILabel + IBUIView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + + + + 292 + {{83, 263}, {155, 21}} + + + + _NS:9 + NO + YES + 7 + NO + IBCocoaTouchFramework + Blue View Controller + + 1 + MCAwIDAAA + darkTextColor + + + 0 + + 1 + 17 + + + Helvetica + 17 + 16 + + NO + + + {{0, 20}, {320, 548}} + + + + + 1 + MC40MDAwMDAwMDYgMC44MDAwMDAwMTE5IDEAA + + + + IBUIScreenMetrics + + YES + + + + + + {320, 568} + {568, 320} + + + IBCocoaTouchFramework + Retina 4 Full Screen + 2 + + IBCocoaTouchFramework + + + + + + + view + + + + 3 + + + + + + 0 + + + + + + 1 + + + + + + 9 + 0 + + 9 + 1 + + 0.0 + + 1000 + + 5 + 22 + 2 + + + + 3 + 0 + + 3 + 1 + + 263 + + 1000 + + 3 + 9 + 3 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + + + VCCBlueViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + 6 + + + + + NSLayoutConstraint + NSObject + + IBProjectSource + ./Classes/NSLayoutConstraint.h + + + + VCCBlueViewController + UIViewController + + IBProjectSource + ./Classes/VCCBlueViewController.h + + + + + 0 + IBCocoaTouchFramework + YES + 3 + YES + 2083 + + diff --git a/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCGreenViewController.h b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCGreenViewController.h new file mode 100644 index 0000000..5a8cf92 --- /dev/null +++ b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCGreenViewController.h @@ -0,0 +1,13 @@ +// +// VCCGreenViewController.h +// ViewControllerContainment +// +// Created by Wojtek Nagrodzki on 11/04/2013. +// Copyright (c) 2013 Wojtek Nagrodzki. All rights reserved. +// + +#import + +@interface VCCGreenViewController : UIViewController + +@end diff --git a/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCGreenViewController.m b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCGreenViewController.m new file mode 100644 index 0000000..e146d9a --- /dev/null +++ b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCGreenViewController.m @@ -0,0 +1,60 @@ +// +// VCCGreenViewController.m +// ViewControllerContainment +// +// Created by Wojtek Nagrodzki on 11/04/2013. +// Copyright (c) 2013 Wojtek Nagrodzki. All rights reserved. +// + +#import "VCCGreenViewController.h" + +@interface VCCGreenViewController () + +@end + +@implementation VCCGreenViewController + +#pragma mark - Overriden (Appearanca Callbacks) + +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + NGLogMessage(); +} + +- (void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; + NGLogMessage(); +} + +- (void)viewWillDisappear:(BOOL)animated +{ + [super viewWillDisappear:animated]; + NGLogMessage(); +} + +- (void)viewDidDisappear:(BOOL)animated +{ + [super viewDidDisappear:animated]; + NGLogMessage(); +} + +#pragma mark - Overriden (Rotation Callbacks) + +- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration +{ + NGLogMessage(); +} + +- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation +{ + NGLogMessage(); +} + +- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration +{ + NGLogMessage(); +} + +@end diff --git a/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCGreenViewController.xib b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCGreenViewController.xib new file mode 100644 index 0000000..40c721b --- /dev/null +++ b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCGreenViewController.xib @@ -0,0 +1,234 @@ + + + + 1552 + 12D78 + 3084 + 1187.37 + 626.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 2083 + + + IBNSLayoutConstraint + IBProxyObject + IBUILabel + IBUIView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + + + + 292 + {{76, 263}, {168, 21}} + + + _NS:9 + NO + YES + 7 + NO + IBCocoaTouchFramework + Green View Controller + + 1 + MCAwIDAAA + darkTextColor + + + 0 + + 1 + 17 + + + Helvetica + 17 + 16 + + NO + + + {{0, 20}, {320, 548}} + + + + 1 + MC40MDAwMDAwMDYgMSAwLjQwMDAwMDAwNgA + + + + IBUIScreenMetrics + + YES + + + + + + {320, 568} + {568, 320} + + + IBCocoaTouchFramework + Retina 4 Full Screen + 2 + + IBCocoaTouchFramework + + + + + + + view + + + + 3 + + + + + + 0 + + + + + + 1 + + + + + + 9 + 0 + + 9 + 1 + + 0.0 + + 1000 + + 5 + 22 + 2 + + + + 3 + 0 + + 3 + 1 + + 263 + + 1000 + + 3 + 9 + 3 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + + + VCCGreenViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + 6 + + + + + NSLayoutConstraint + NSObject + + IBProjectSource + ./Classes/NSLayoutConstraint.h + + + + VCCGreenViewController + UIViewController + + IBProjectSource + ./Classes/VCCGreenViewController.h + + + + + 0 + IBCocoaTouchFramework + YES + 3 + YES + 2083 + + diff --git a/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCRedViewController.h b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCRedViewController.h new file mode 100644 index 0000000..6eb75d6 --- /dev/null +++ b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCRedViewController.h @@ -0,0 +1,13 @@ +// +// VCCRedViewController.h +// ViewControllerContainment +// +// Created by Wojtek Nagrodzki on 11/04/2013. +// Copyright (c) 2013 Wojtek Nagrodzki. All rights reserved. +// + +#import + +@interface VCCRedViewController : UIViewController + +@end diff --git a/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCRedViewController.m b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCRedViewController.m new file mode 100644 index 0000000..abf75fa --- /dev/null +++ b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCRedViewController.m @@ -0,0 +1,60 @@ +// +// VCCRedViewController.m +// ViewControllerContainment +// +// Created by Wojtek Nagrodzki on 11/04/2013. +// Copyright (c) 2013 Wojtek Nagrodzki. All rights reserved. +// + +#import "VCCRedViewController.h" + +@interface VCCRedViewController () + +@end + +@implementation VCCRedViewController + +#pragma mark - Overriden (Appearanca Callbacks) + +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + NGLogMessage(); +} + +- (void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; + NGLogMessage(); +} + +- (void)viewWillDisappear:(BOOL)animated +{ + [super viewWillDisappear:animated]; + NGLogMessage(); +} + +- (void)viewDidDisappear:(BOOL)animated +{ + [super viewDidDisappear:animated]; + NGLogMessage(); +} + +#pragma mark - Overriden (Rotation Callbacks) + +- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration +{ + NGLogMessage(); +} + +- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation +{ + NGLogMessage(); +} + +- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration +{ + NGLogMessage(); +} + +@end diff --git a/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCRedViewController.xib b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCRedViewController.xib new file mode 100644 index 0000000..a7bce32 --- /dev/null +++ b/ViewControllerContainment/ViewControllerContainment/ViewControllers/VCCRedViewController.xib @@ -0,0 +1,236 @@ + + + + 1552 + 12D78 + 3084 + 1187.37 + 626.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 2083 + + + IBNSLayoutConstraint + IBProxyObject + IBUILabel + IBUIView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + + + + 292 + {{84, 263}, {152, 21}} + + + + _NS:9 + NO + YES + 7 + NO + IBCocoaTouchFramework + Red View Controller + + 1 + MCAwIDAAA + darkTextColor + + + 0 + + 1 + 17 + + + Helvetica + 17 + 16 + + NO + + + {{0, 20}, {320, 548}} + + + + + 1 + MSAwLjQwMDAwMDAwNiAwLjQwMDAwMDAwNgA + + + + IBUIScreenMetrics + + YES + + + + + + {320, 568} + {568, 320} + + + IBCocoaTouchFramework + Retina 4 Full Screen + 2 + + IBCocoaTouchFramework + + + + + + + view + + + + 3 + + + + + + 0 + + + + + + 1 + + + + + 9 + 0 + + 9 + 1 + + 0.0 + + 1000 + + 5 + 22 + 2 + + + + 3 + 0 + + 3 + 1 + + 263 + + 1000 + + 3 + 9 + 3 + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + + + VCCRedViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + 6 + + + + + NSLayoutConstraint + NSObject + + IBProjectSource + ./Classes/NSLayoutConstraint.h + + + + VCCRedViewController + UIViewController + + IBProjectSource + ./Classes/VCCRedViewController.h + + + + + 0 + IBCocoaTouchFramework + YES + 3 + YES + 2083 + +