phonegap-orientation-ios
Objective-C JavaScript
Latest commit b6125d0 Jul 7, 2014 @acti0nm4n Merge pull request #2 from mattmcdonald-uk/patch-1
Create plugin.xml
Permalink
Failed to load latest commit information.
Orientation.h added files Apr 24, 2012
Orientation.m added files Apr 24, 2012
OrientationPlugin.js Removed whitespace May 15, 2013
README.md Update README.md Apr 24, 2012
plugin.xml Create plugin.xml Aug 2, 2013

README.md

Phonegap-Orientation-iOS

Plugin for enabling/disabling device orientation

In Xcode project

Place Orientation.h & Orientation.m in to plugins folder

Add into Appdelegate.h

...

    @interface AppDelegate : PhoneGapDelegate {

        NSString* invokeString;
    }

    - @property (copy)  NSString* invokeString;

    - (void)setOrientation:(NSArray *)arguments;

@end

Add into AppDelegate.m

...
    - (void) dealloc
    {
        [super dealloc];
    }

    - (void)setOrientation:(NSArray *)arguments
    {
        self.viewController.supportedOrientations = arguments;
    }
@end

Add field into Supporting Files / .plist

name: orientation (value: Orientation)

Usage

Include OrienationPlugin.js in index.html

Params in object:

  • pp - Portrait
  • pd - Portrait upside down
  • ll - Landscape left
  • lr - Landscape right

Examples (in javascript)

Portrait only

window.plugins.orientation.setAllowed([{pp:true, pd:false, ll:false, lr:false}]);

All, except Portrait upside down

window.plugins.orientation.setAllowed([{pp:true, pd:false, ll:true, lr:true}]);