Repository: cordova-ios
Updated Branches:
  refs/heads/master 865f4107d -> a26aae0c4


CB-11648: Make CDVViewController send notifications when UIViewController 
methods are called

 This closes #239


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/a26aae0c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/a26aae0c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/a26aae0c

Branch: refs/heads/master
Commit: a26aae0c44af594dcd9d1e3b2569731c5b5ec202
Parents: 865f410
Author: Julio César <jcesarmob...@gmail.com>
Authored: Sat Jul 30 22:48:57 2016 +0200
Committer: Shazron Abdullah <shaz...@apache.org>
Committed: Mon Aug 15 16:36:16 2016 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/Public/CDVPlugin.h         |  7 ++++
 CordovaLib/Classes/Public/CDVPlugin.m         | 15 ++++++++
 CordovaLib/Classes/Public/CDVViewController.m | 42 ++++++++++++++++++++++
 3 files changed, 64 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a26aae0c/CordovaLib/Classes/Public/CDVPlugin.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Public/CDVPlugin.h 
b/CordovaLib/Classes/Public/CDVPlugin.h
index 54c8afd..b773d60 100644
--- a/CordovaLib/Classes/Public/CDVPlugin.h
+++ b/CordovaLib/Classes/Public/CDVPlugin.h
@@ -36,6 +36,13 @@ extern NSString* const CDVPluginResetNotification;
 extern NSString* const CDVLocalNotification;
 extern NSString* const CDVRemoteNotification;
 extern NSString* const CDVRemoteNotificationError;
+extern NSString* const CDVViewWillAppearNotification;
+extern NSString* const CDVViewDidAppearNotification;
+extern NSString* const CDVViewWillDisappearNotification;
+extern NSString* const CDVViewDidDisappearNotification;
+extern NSString* const CDVViewWillLayoutSubviewsNotification;
+extern NSString* const CDVViewDidLayoutSubviewsNotification;
+extern NSString* const CDVViewWillTransitionToSizeNotification;
 
 @interface CDVPlugin : NSObject {}
 

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a26aae0c/CordovaLib/Classes/Public/CDVPlugin.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Public/CDVPlugin.m 
b/CordovaLib/Classes/Public/CDVPlugin.m
index ac3a8ee..af29cad 100644
--- a/CordovaLib/Classes/Public/CDVPlugin.m
+++ b/CordovaLib/Classes/Public/CDVPlugin.m
@@ -46,6 +46,13 @@ NSString* const CDVPluginResetNotification = 
@"CDVPluginResetNotification";
 NSString* const CDVLocalNotification = @"CDVLocalNotification";
 NSString* const CDVRemoteNotification = @"CDVRemoteNotification";
 NSString* const CDVRemoteNotificationError = @"CDVRemoteNotificationError";
+NSString* const CDVViewWillAppearNotification = 
@"CDVViewWillAppearNotification";
+NSString* const CDVViewDidAppearNotification = @"CDVViewDidAppearNotification";
+NSString* const CDVViewWillDisappearNotification = 
@"CDVViewWillDisappearNotification";
+NSString* const CDVViewDidDisappearNotification = 
@"CDVViewDidDisappearNotification";
+NSString* const CDVViewWillLayoutSubviewsNotification = 
@"CDVViewWillLayoutSubviewsNotification";
+NSString* const CDVViewDidLayoutSubviewsNotification = 
@"CDVViewDidLayoutSubviewsNotification";
+NSString* const CDVViewWillTransitionToSizeNotification = 
@"CDVViewWillTransitionToSizeNotification";
 
 @interface CDVPlugin ()
 
@@ -90,6 +97,14 @@ NSString* const CDVRemoteNotificationError = 
@"CDVRemoteNotificationError";
 
     // Added in 2.5.0
     // [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(pageDidLoad:) name:CDVPageDidLoadNotification 
object:self.webView];
+    //Added in 4.3.0
+    // [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(viewWillAppear:) name:CDVViewWillAppearNotification 
object:nil];
+    // [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(viewDidAppear:) name:CDVViewDidAppearNotification 
object:nil];
+    // [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(viewWillDisappear:) name:CDVViewWillDisappearNotification 
object:nil];
+    // [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(viewDidDisappear:) name:CDVViewDidDisappearNotification 
object:nil];
+    // [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(viewWillLayoutSubviews:) 
name:CDVViewWillLayoutSubviewsNotification object:nil];
+    // [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(viewDidLayoutSubviews:) 
name:CDVViewDidLayoutSubviewsNotification object:nil];
+    // [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(viewWillTransitionToSize:) 
name:CDVViewWillTransitionToSizeNotification object:nil];
 }
 
 - (void)dispose

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a26aae0c/CordovaLib/Classes/Public/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Public/CDVViewController.m 
b/CordovaLib/Classes/Public/CDVViewController.m
index d7acea7..4d4cd47 100644
--- a/CordovaLib/Classes/Public/CDVViewController.m
+++ b/CordovaLib/Classes/Public/CDVViewController.m
@@ -344,6 +344,48 @@
     }];
 }
 
+-(void)viewWillAppear:(BOOL)animated
+{
+    [super viewWillAppear:animated];
+    [[NSNotificationCenter defaultCenter] postNotification:[NSNotification 
notificationWithName:CDVViewWillAppearNotification object:nil]];
+}
+
+-(void)viewDidAppear:(BOOL)animated
+{
+    [super viewDidAppear:animated];
+    [[NSNotificationCenter defaultCenter] postNotification:[NSNotification 
notificationWithName:CDVViewDidAppearNotification object:nil]];
+}
+
+-(void)viewWillDisappear:(BOOL)animated
+{
+    [super viewWillDisappear:animated];
+    [[NSNotificationCenter defaultCenter] postNotification:[NSNotification 
notificationWithName:CDVViewWillDisappearNotification object:nil]];
+}
+
+-(void)viewDidDisappear:(BOOL)animated
+{
+    [super viewDidDisappear:animated];
+    [[NSNotificationCenter defaultCenter] postNotification:[NSNotification 
notificationWithName:CDVViewDidDisappearNotification object:nil]];
+}
+
+-(void)viewWillLayoutSubviews
+{
+    [super viewWillLayoutSubviews];
+    [[NSNotificationCenter defaultCenter] postNotification:[NSNotification 
notificationWithName:CDVViewWillLayoutSubviewsNotification object:nil]];
+}
+
+-(void)viewDidLayoutSubviews
+{
+    [super viewDidLayoutSubviews];
+    [[NSNotificationCenter defaultCenter] postNotification:[NSNotification 
notificationWithName:CDVViewDidLayoutSubviewsNotification object:nil]];
+}
+
+-(void)viewWillTransitionToSize:(CGSize)size 
withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
+{
+    [super viewWillTransitionToSize:size 
withTransitionCoordinator:coordinator];
+    [[NSNotificationCenter defaultCenter] postNotification:[NSNotification 
notificationWithName:CDVViewWillTransitionToSizeNotification object:[NSValue 
valueWithCGSize:size]]];
+}
+
 - (NSArray*)parseInterfaceOrientations:(NSArray*)orientations
 {
     NSMutableArray* result = [[NSMutableArray alloc] init];


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to