0

Is there any way to control the rotation of an Salesforce IOS Hybrid app. I'm using Salesforce IOS SDK. I want to have some of the screens allow to rotate and some not. I know we can set it the app's general setting but it will apply across the whole app not into each screen.

0

Your UIViewController subclass should override shouldAutorotate (returning YES) and supportedInterfaceOrientations (returning an appropriate orientation mask).

5
  • Hi Jonathan, thanks for your help again:) I can got it working this way in a native app. However, a hybrid app is just an web view. How do we control the orientations based on the page url?
    – AlexW
    Jan 13 '15 at 4:43
  • A "hybrid" app is one or more native view controllers that each display a webview. You should be able to subclass the view controllers included with the SDK and override their rotation methods. Jan 13 '15 at 16:10
  • Awesome:). I made it happen by what you said. However, webViewDidStartLoad didn't pick up ajax calls from the htmls, I wonder if there is anyway to get ajax calls to talk to UIViewController.
    – AlexW
    Jan 14 '15 at 1:38
  • UIWebViewDelegate methods fire only when the request (URL) changes. Traditionally you would hook into AJAX requests by injecting your own javascript into the page, or by using a third-party native-JS bridge. Jan 14 '15 at 2:22
  • Just notice shouldStartLoadWithRequest picks up ajax requests. Maybe we can add logic into that.
    – AlexW
    Jan 14 '15 at 4:01
0

You can use cordova plugin to controll the device orientation for specific view https://github.com/apache/cordova-plugin-screen-orientation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.