Skip to content

Commit

Permalink
Fixed interfaceOrientation deprecated warning
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaxt committed Apr 11, 2015
1 parent 8681050 commit 43cb763
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 26 deletions.
2 changes: 2 additions & 0 deletions SlideMenu.xcodeproj/project.pbxproj
Expand Up @@ -525,6 +525,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "SlideMenu/SlideMenu-Prefix.pch";
INFOPLIST_FILE = "SlideMenu/SlideMenu-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
Expand All @@ -536,6 +537,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "SlideMenu/SlideMenu-Prefix.pch";
INFOPLIST_FILE = "SlideMenu/SlideMenu-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
Expand Down
2 changes: 1 addition & 1 deletion SlideMenu/SlideMenu-Info.plist
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.aryaxt.${PRODUCT_NAME:rfc1034identifier}</string>
<string>com.aryaxt.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
Expand Up @@ -58,7 +58,7 @@ - (void)prepareMenuForAnimation:(Menu)menu
? [SlideNavigationController sharedInstance].leftMenu
: [SlideNavigationController sharedInstance].rightMenu;

UIInterfaceOrientation orientation= [SlideNavigationController sharedInstance].interfaceOrientation;
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
CGRect rect = menuViewController.view.frame;

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
Expand All @@ -67,9 +67,9 @@ - (void)prepareMenuForAnimation:(Menu)menu
}
else
{
if (UIInterfaceOrientationIsLandscape(orientation))
if (UIDeviceOrientationIsLandscape(orientation))
{
if (orientation == UIInterfaceOrientationLandscapeRight)
if (orientation == UIDeviceOrientationLandscapeRight)
{
rect.origin.y = (menu == MenuLeft) ? self.slideMovement*-1 : self.slideMovement;
}
Expand All @@ -80,7 +80,7 @@ - (void)prepareMenuForAnimation:(Menu)menu
}
else
{
if (orientation == UIInterfaceOrientationPortrait)
if (orientation == UIDeviceOrientationPortrait)
{
rect.origin.x = (menu == MenuLeft) ? self.slideMovement*-1 : self.slideMovement;
}
Expand All @@ -100,7 +100,7 @@ - (void)animateMenu:(Menu)menu withProgress:(CGFloat)progress
? [SlideNavigationController sharedInstance].leftMenu
: [SlideNavigationController sharedInstance].rightMenu;

UIInterfaceOrientation orientation = [SlideNavigationController sharedInstance].interfaceOrientation;
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;

NSInteger location = (menu == MenuLeft)
? (self.slideMovement * -1) + (self.slideMovement * progress)
Expand All @@ -120,13 +120,13 @@ - (void)animateMenu:(Menu)menu withProgress:(CGFloat)progress
}
else
{
if (UIInterfaceOrientationIsLandscape(orientation))
if (UIDeviceOrientationIsLandscape(orientation))
{
rect.origin.y = (orientation == UIInterfaceOrientationLandscapeRight) ? location : location*-1;
rect.origin.y = (orientation == UIDeviceOrientationLandscapeRight) ? location : location*-1;
}
else
{
rect.origin.x = (orientation == UIInterfaceOrientationPortrait) ? location : location*-1;
rect.origin.x = (orientation == UIDeviceOrientationPortrait) ? location : location*-1;
}
}

Expand All @@ -147,8 +147,8 @@ - (void)clearMenu:(Menu)menu
? [SlideNavigationController sharedInstance].leftMenu
: [SlideNavigationController sharedInstance].rightMenu;

UIInterfaceOrientation orientation= [SlideNavigationController sharedInstance].interfaceOrientation;
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
CGRect rect = menuViewController.view.frame;

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
Expand All @@ -157,7 +157,7 @@ - (void)clearMenu:(Menu)menu
}
else
{
if (UIInterfaceOrientationIsLandscape(orientation))
if (UIDeviceOrientationIsLandscape(orientation))
{
rect.origin.y = 0;
}
Expand Down
30 changes: 16 additions & 14 deletions SlideMenu/Source/SlideNavigationController.m
Expand Up @@ -520,7 +520,7 @@ - (void)closeMenuWithDuration:(float)duration andCompletion:(void (^)())completi
- (void)moveHorizontallyToLocation:(CGFloat)location
{
CGRect rect = self.view.frame;
UIInterfaceOrientation orientation = self.interfaceOrientation;
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
Menu menu = (self.horizontalLocation >= 0 && location >= 0) ? MenuLeft : MenuRight;

if ((location > 0 && self.horizontalLocation <= 0) || (location < 0 && self.horizontalLocation >= 0)) {
Expand All @@ -534,14 +534,14 @@ - (void)moveHorizontallyToLocation:(CGFloat)location
}
else
{
if (UIInterfaceOrientationIsLandscape(orientation))
if (UIDeviceOrientationIsLandscape(orientation))
{
rect.origin.x = 0;
rect.origin.y = (orientation == UIInterfaceOrientationLandscapeRight) ? location : location*-1;
rect.origin.y = (orientation == UIDeviceOrientationLandscapeRight) ? location : location*-1;
}
else
{
rect.origin.x = (orientation == UIInterfaceOrientationPortrait) ? location : location*-1;
rect.origin.x = (orientation == UIDeviceOrientationPortrait) ? location : location*-1;
rect.origin.y = 0;
}
}
Expand Down Expand Up @@ -570,16 +570,18 @@ - (CGRect)initialRectForMenu
return rect;
}

if (UIInterfaceOrientationIsLandscape(self.interfaceOrientation))
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;

if (UIDeviceOrientationIsLandscape(orientation))
{
// For some reasons in landscape below the status bar is considered y=0, but in portrait it's considered y=20
rect.origin.x = (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight) ? 0 : STATUS_BAR_HEIGHT;
rect.origin.x = (orientation == UIDeviceOrientationLandscapeRight) ? 0 : STATUS_BAR_HEIGHT;
rect.size.width = self.view.frame.size.width-STATUS_BAR_HEIGHT;
}
else
{
// For some reasons in landscape below the status bar is considered y=0, but in portrait it's considered y=20
rect.origin.y = (self.interfaceOrientation == UIInterfaceOrientationPortrait) ? STATUS_BAR_HEIGHT : 0;
rect.origin.y = (orientation == UIDeviceOrientationPortrait) ? STATUS_BAR_HEIGHT : 0;
rect.size.height = self.view.frame.size.height-STATUS_BAR_HEIGHT;
}

Expand Down Expand Up @@ -608,23 +610,23 @@ - (void)prepareMenuForReveal:(Menu)menu
- (CGFloat)horizontalLocation
{
CGRect rect = self.view.frame;
UIInterfaceOrientation orientation = self.interfaceOrientation;
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
{
return rect.origin.x;
}
else
{
if (UIInterfaceOrientationIsLandscape(orientation))
if (UIDeviceOrientationIsLandscape(orientation))
{
return (orientation == UIInterfaceOrientationLandscapeRight)
return (orientation == UIDeviceOrientationLandscapeRight)
? rect.origin.y
: rect.origin.y*-1;
}
else
{
return (orientation == UIInterfaceOrientationPortrait)
return (orientation == UIDeviceOrientationPortrait)
? rect.origin.x
: rect.origin.x*-1;
}
Expand All @@ -634,15 +636,15 @@ - (CGFloat)horizontalLocation
- (CGFloat)horizontalSize
{
CGRect rect = self.view.frame;
UIInterfaceOrientation orientation = self.interfaceOrientation;
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
{
return rect.size.width;
}
else
{
if (UIInterfaceOrientationIsLandscape(orientation))
if (UIDeviceOrientationIsLandscape(orientation))
{
return rect.size.height;
}
Expand Down Expand Up @@ -675,7 +677,7 @@ - (void)navigationController:(UINavigationController *)navigationController

- (CGFloat)slideOffset
{
return (UIInterfaceOrientationIsLandscape(self.interfaceOrientation))
return (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation))
? self.landscapeSlideOffset
: self.portraitSlideOffset;
}
Expand Down

1 comment on commit 43cb763

@sinabs
Copy link

@sinabs sinabs commented on 43cb763 Apr 30, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mark

Please sign in to comment.