Updated Branches:
  refs/heads/master 0a4dbf0ff -> 134d14eaf

Fixes CB-751 - Undefined function is called when orientation change


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

Branch: refs/heads/master
Commit: 134d14eaff2832d491f047303a5bf9733d2be1fb
Parents: 0a4dbf0
Author: Shazron Abdullah <shaz...@apache.org>
Authored: Fri May 11 15:59:48 2012 -0700
Committer: Shazron Abdullah <shaz...@apache.org>
Committed: Fri May 11 16:00:02 2012 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVViewController.m |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/134d14ea/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m 
b/CordovaLib/Classes/CDVViewController.m
index 7abe82c..f3114ce 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -262,7 +262,13 @@
                        break;
        }
        
-       NSString* jsCall = [ NSString 
stringWithFormat:@"shouldRotateToOrientation(%d);",i];
+       NSString* jsCall = [NSString stringWithFormat:
+                        @"(function(){ \
+                                if('shouldRotateToOrientation' in window) { \
+                                    return 
window.shouldRotateToOrientation(%d); \
+                                } \
+                            })()"
+                        , i];
        NSString* res = [webView stringByEvaluatingJavaScriptFromString:jsCall];
        
        if([res length] > 0)

Reply via email to