The iOS framework that grows only as fast as its documentation
Device Orientation

Functions

BOOL NIIsSupportedOrientation (UIInterfaceOrientation orientation)
 
UIInterfaceOrientation NIInterfaceOrientation (void)
 
BOOL NIIsLandscapePhoneOrientation (UIInterfaceOrientation orientation)
 
CGAffineTransform NIRotateTransformForOrientation (UIInterfaceOrientation orientation)
 

Overview

For dealing with device orientations.

Examples

Use NIIsSupportedOrientation to Enable Autorotation

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return NIIsSupportedOrientation(toInterfaceOrientation);
}

Function Documentation

NIIsSupportedOrientation

For use in shouldAutorotateToInterfaceOrientation:

BOOL NIIsSupportedOrientation:(UIInterfaceOrientation)orientation;
Discussion

On iPhone/iPod touch:

 Returns YES if the orientation is portrait, landscape left, or landscape right.
 This helps to ignore upside down and flat orientations.

On iPad:

 Always returns YES.

NIInterfaceOrientation

Returns the application's current interface orientation.

UIInterfaceOrientation NIInterfaceOrientation:;
Discussion

This is simply a convenience method for [UIApplication sharedApplication].statusBarOrientation.

Returns
The current interface orientation.

NIIsLandscapePhoneOrientation

Returns YES if the device is a phone and the orientation is landscape.

BOOL NIIsLandscapePhoneOrientation:(UIInterfaceOrientation)orientation;
Discussion

This is a useful check for phone landscape mode which often requires additional logic to handle the smaller vertical real estate.

Returns
YES if the device is a phone and orientation is landscape.

NIRotateTransformForOrientation

Creates an affine transform for the given device orientation.

CGAffineTransform NIRotateTransformForOrientation:(UIInterfaceOrientation)orientation;
Discussion

This is useful for creating a transformation matrix for a view that has been added directly to the window and doesn't automatically have its transformation modified.