Latest 0.0.1
Homepage https://github.com/ulian-onua/KRNOrientation
License MIT
Platforms ios 8.0, requires ARC
Frameworks Foundation, UIKit
Authors

KRNOrientation is a simple class that helps you to get current orientation of your iOS device.

Installation

CocoaPods

(Unfamiliar with CocoaPods yet? It’s a dependency management tool for iOS and Mac, check it out!)

Just add pod 'KRNOrientation' to your Podfile and run pod install in Terminal from your project folder.

Write #import "KRNOrientation.h" in files where you need to use KRNOrientation.

How to use

All methods of KRNOrientation are static so you can simply call any of method without necessity of allocation of KRNOrientation class instance.

To get current orientation you can use one of next methods:

+ (UIInterfaceOrientation)deviceOrientation;  // returns current device orientation as a enum type of UIInterfaceOrientation. Return value can be simply used in switch/case construction.

// Basic methods
+ (BOOL)isPortrait;  // returns YES if current orientation is Portrait or PortraitUpsideDown
+ (BOOL)isLandscape; // returns YES if current orientation is LandscapeLeft of LandscapeRight

// More concrete methods
+ (BOOL)isNormalPortrait;  // returns YES if current orientation is Portrait (but not PortraitUpsideDown)
+ (BOOL)isUpsideDownPortrait; // returns YES if current orientation is PortraitUpsideDown
+ (BOOL)isLandscapeLeft; // returns YES if current orientation is Landscape Left
+ (BOOL)isLandscapeRight; // returns YES if current orientation is Landscape Right

Requirements

  • iOS 8.0 and above
  • XCode 7+

License

KRNOrientation is released under the MIT license. See LICENSE for details.

Contact

Any suggestion or question? Please create a Github issue or reach me out.

LinkedIn

Latest podspec

{
    "name": "KRNOrientation",
    "version": "0.0.1",
    "summary": "KRNOrientation is a simple class that helps you to get current orientation of your iOS device.",
    "homepage": "https://github.com/ulian-onua/KRNOrientation",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Julian Drapaylo": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/ulian-onua/KRNOrientation.git",
        "tag": "0.0.1"
    },
    "source_files": "KRNOrientation/*.{h,m}",
    "public_header_files": "KRNOrientation/*.h",
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This