Skip to content

Commit

Permalink
[core] Add NIInterfaceOrientation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jverkoey committed Jun 14, 2011
1 parent 67aad67 commit 900e02c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/core/src/NIDeviceOrientation.m
Expand Up @@ -19,6 +19,21 @@
#import "NimbusCore.h"


///////////////////////////////////////////////////////////////////////////////////////////////////
UIInterfaceOrientation NIInterfaceOrientation() {
UIInterfaceOrientation orient = [UIApplication sharedApplication].statusBarOrientation;

// This code used to use the navigator to find the currently visible view controller and
// fall back to checking its orientation if we didn't know the status bar's orientation.
// It's unclear when this was actually necessary, though, so this assertion is here to try
// to find that case. If this assertion fails then the repro case needs to be analyzed and
// this method made more robust to handle that case.
NIDASSERT(UIDeviceOrientationUnknown != orient);

return orient;
}


///////////////////////////////////////////////////////////////////////////////////////////////////
BOOL NIIsSupportedOrientation(UIInterfaceOrientation orientation) {
if (NIIsPad()) {
Expand Down
7 changes: 7 additions & 0 deletions src/core/src/NimbusCore.h
Expand Up @@ -402,6 +402,13 @@ CGRect NIRectInset(CGRect rect, UIEdgeInsets insets);
*/
BOOL NIIsSupportedOrientation(UIInterfaceOrientation orientation);

/**
* @brief Returns the application's current interface orientation.
*
* @returns The current interface orientation.
*/
UIInterfaceOrientation NIInterfaceOrientation();


///////////////////////////////////////////////////////////////////////////////////////////////////
/**@}*/// End of Device Orientation ///////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 900e02c

Please sign in to comment.