Latest 0.2.6
Homepage https://github.com/sisoje/RHBOrientationObjC
License MIT
Platforms ios 8.0
Dependencies RHBSnippetsObjC
Frameworks UIKit, CoreMotion, AVFoundation
Authors

alt tag

[![CI Status](http://img.shields.io/travis/Lazar Otasevic/RHBOrientationObjC.svg?style=flat)](https://travis-ci.org/Lazar Otasevic/RHBOrientationObjC)
Version
License
Platform

RHBOrientation is an easy to use and customizable Objective-C library for estimating device orientation based on accelerometer data.

RHBOrientation uses raw accelerometer data to detect current phone orientation, and it works even when device is in "Orientation Lock" mode.

Orientation detection uses PROPERLY designed "orientation snapping" algorithm with customizable z-axis and orientation snapping treshold value.

Usage

Import RHBOrientationObjC header file:

    #import "RHBOrientation.h"

Initialize orientation detection (for example in viewDidLoad) in your view controller:

    self.orienter = [RHBOrienter new];

Obtain orientation anytime using:

    self.orienter.deviceOrientation

Optionally setup delegate and implement delegate method to get notifications whenever orientation changes.

    self.orienter.delegate = self;

Your class must comply to RHBOrienterDelegate protocol and implement method:

    - (void)didChangeDeviceOrientation:(RHBOrienter *)orienter oldOrientation:(UIDeviceOrientation)oldOrientation newOrientation:(UIDeviceOrientation)newOrientation;

Example

Clone the repo, and open Example/RHBOrientationObjC.xcodeproj. Orientation detection does not work in Simulator, since simulator does not support accelerometer.

Installation

RHBOrientationObjC is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "RHBOrientationObjC"

Author

Lazar Otasevic, [email protected]

License

RHBOrientationObjC is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "RHBOrientationObjC",
    "version": "0.2.6",
    "summary": "Estimating device orientation based on accelerometer data with "orientation snapping". Great for camera and photo apps.",
    "description": "RHBOrientation is an easy to use and customizable library for estimating device orientation based on accelerometer data. Written in Objective-C. Orientation detection uses PROPERLY designed "orientation snapping" algorithm with customizable z-axis and orientation snapping treshold value.",
    "homepage": "https://github.com/sisoje/RHBOrientationObjC",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Lazar Otasevic": "[email protected]"
    },
    "source": {
        "git": "https://github.com/sisoje/RHBOrientationObjC.git",
        "tag": "0.2.6"
    },
    "social_media_url": "https://twitter.com/redhotbits",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "RHBOrientationObjC/Classes/**/*",
    "frameworks": [
        "UIKit",
        "CoreMotion",
        "AVFoundation"
    ],
    "dependencies": {
        "RHBSnippetsObjC": []
    }
}

Pin It on Pinterest

Share This