Skip to content

Commit 2ddf700

Browse files
committed
Merge pull request #175 from aryaxt/AG/SwitchToUsingStatusBarOrientation
Switch to using status bar orientation
2 parents a8ab4c1 + 7fbbaed commit 2ddf700

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

SlideMenu/Source/Animations/SlideNavigationContorllerAnimatorSlide.m

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ - (void)prepareMenuForAnimation:(Menu)menu
5858
? [SlideNavigationController sharedInstance].leftMenu
5959
: [SlideNavigationController sharedInstance].rightMenu;
6060

61-
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
61+
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
6262
CGRect rect = menuViewController.view.frame;
6363

6464
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
@@ -67,9 +67,9 @@ - (void)prepareMenuForAnimation:(Menu)menu
6767
}
6868
else
6969
{
70-
if (UIDeviceOrientationIsLandscape(orientation))
70+
if (UIInterfaceOrientationIsLandscape(orientation))
7171
{
72-
if (orientation == UIDeviceOrientationLandscapeRight)
72+
if (orientation == UIInterfaceOrientationLandscapeRight)
7373
{
7474
rect.origin.y = (menu == MenuLeft) ? self.slideMovement*-1 : self.slideMovement;
7575
}
@@ -80,7 +80,7 @@ - (void)prepareMenuForAnimation:(Menu)menu
8080
}
8181
else
8282
{
83-
if (orientation == UIDeviceOrientationPortrait)
83+
if (orientation == UIInterfaceOrientationPortrait)
8484
{
8585
rect.origin.x = (menu == MenuLeft) ? self.slideMovement*-1 : self.slideMovement;
8686
}
@@ -100,7 +100,7 @@ - (void)animateMenu:(Menu)menu withProgress:(CGFloat)progress
100100
? [SlideNavigationController sharedInstance].leftMenu
101101
: [SlideNavigationController sharedInstance].rightMenu;
102102

103-
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
103+
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
104104

105105
NSInteger location = (menu == MenuLeft)
106106
? (self.slideMovement * -1) + (self.slideMovement * progress)
@@ -120,13 +120,13 @@ - (void)animateMenu:(Menu)menu withProgress:(CGFloat)progress
120120
}
121121
else
122122
{
123-
if (UIDeviceOrientationIsLandscape(orientation))
123+
if (UIInterfaceOrientationIsLandscape(orientation))
124124
{
125-
rect.origin.y = (orientation == UIDeviceOrientationLandscapeRight) ? location : location*-1;
125+
rect.origin.y = (orientation == UIInterfaceOrientationLandscapeRight) ? location : location*-1;
126126
}
127127
else
128128
{
129-
rect.origin.x = (orientation == UIDeviceOrientationPortrait) ? location : location*-1;
129+
rect.origin.x = (orientation == UIInterfaceOrientationPortrait) ? location : location*-1;
130130
}
131131
}
132132

@@ -147,7 +147,7 @@ - (void)clearMenu:(Menu)menu
147147
? [SlideNavigationController sharedInstance].leftMenu
148148
: [SlideNavigationController sharedInstance].rightMenu;
149149

150-
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
150+
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
151151

152152
CGRect rect = menuViewController.view.frame;
153153

@@ -157,7 +157,7 @@ - (void)clearMenu:(Menu)menu
157157
}
158158
else
159159
{
160-
if (UIDeviceOrientationIsLandscape(orientation))
160+
if (UIInterfaceOrientationIsLandscape(orientation))
161161
{
162162
rect.origin.y = 0;
163163
}

SlideMenu/Source/SlideNavigationController.m

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ - (void)closeMenuWithDuration:(float)duration andCompletion:(void (^)())completi
520520
- (void)moveHorizontallyToLocation:(CGFloat)location
521521
{
522522
CGRect rect = self.view.frame;
523-
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
523+
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
524524
Menu menu = (self.horizontalLocation >= 0 && location >= 0) ? MenuLeft : MenuRight;
525525

526526
if ((location > 0 && self.horizontalLocation <= 0) || (location < 0 && self.horizontalLocation >= 0)) {
@@ -534,14 +534,14 @@ - (void)moveHorizontallyToLocation:(CGFloat)location
534534
}
535535
else
536536
{
537-
if (UIDeviceOrientationIsLandscape(orientation))
537+
if (UIInterfaceOrientationIsLandscape(orientation))
538538
{
539539
rect.origin.x = 0;
540-
rect.origin.y = (orientation == UIDeviceOrientationLandscapeRight) ? location : location*-1;
540+
rect.origin.y = (orientation == UIInterfaceOrientationLandscapeRight) ? location : location*-1;
541541
}
542542
else
543543
{
544-
rect.origin.x = (orientation == UIDeviceOrientationPortrait) ? location : location*-1;
544+
rect.origin.x = (orientation == UIInterfaceOrientationPortrait) ? location : location*-1;
545545
rect.origin.y = 0;
546546
}
547547
}
@@ -570,18 +570,18 @@ - (CGRect)initialRectForMenu
570570
return rect;
571571
}
572572

573-
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
573+
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
574574

575-
if (UIDeviceOrientationIsLandscape(orientation))
575+
if (UIInterfaceOrientationIsLandscape(orientation))
576576
{
577577
// For some reasons in landscape below the status bar is considered y=0, but in portrait it's considered y=20
578-
rect.origin.x = (orientation == UIDeviceOrientationLandscapeRight) ? 0 : STATUS_BAR_HEIGHT;
578+
rect.origin.x = (orientation == UIInterfaceOrientationLandscapeRight) ? 0 : STATUS_BAR_HEIGHT;
579579
rect.size.width = self.view.frame.size.width-STATUS_BAR_HEIGHT;
580580
}
581581
else
582582
{
583583
// For some reasons in landscape below the status bar is considered y=0, but in portrait it's considered y=20
584-
rect.origin.y = (orientation == UIDeviceOrientationPortrait) ? STATUS_BAR_HEIGHT : 0;
584+
rect.origin.y = (orientation == UIInterfaceOrientationPortrait) ? STATUS_BAR_HEIGHT : 0;
585585
rect.size.height = self.view.frame.size.height-STATUS_BAR_HEIGHT;
586586
}
587587

@@ -610,23 +610,23 @@ - (void)prepareMenuForReveal:(Menu)menu
610610
- (CGFloat)horizontalLocation
611611
{
612612
CGRect rect = self.view.frame;
613-
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
613+
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
614614

615615
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
616616
{
617617
return rect.origin.x;
618618
}
619619
else
620620
{
621-
if (UIDeviceOrientationIsLandscape(orientation))
621+
if (UIInterfaceOrientationIsLandscape(orientation))
622622
{
623-
return (orientation == UIDeviceOrientationLandscapeRight)
623+
return (orientation == UIInterfaceOrientationLandscapeRight)
624624
? rect.origin.y
625625
: rect.origin.y*-1;
626626
}
627627
else
628628
{
629-
return (orientation == UIDeviceOrientationPortrait)
629+
return (orientation == UIInterfaceOrientationPortrait)
630630
? rect.origin.x
631631
: rect.origin.x*-1;
632632
}
@@ -636,15 +636,15 @@ - (CGFloat)horizontalLocation
636636
- (CGFloat)horizontalSize
637637
{
638638
CGRect rect = self.view.frame;
639-
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
639+
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
640640

641641
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
642642
{
643643
return rect.size.width;
644644
}
645645
else
646646
{
647-
if (UIDeviceOrientationIsLandscape(orientation))
647+
if (UIInterfaceOrientationIsLandscape(orientation))
648648
{
649649
return rect.size.height;
650650
}
@@ -677,7 +677,7 @@ - (void)navigationController:(UINavigationController *)navigationController
677677

678678
- (CGFloat)slideOffset
679679
{
680-
return (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation))
680+
return (UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation))
681681
? self.landscapeSlideOffset
682682
: self.portraitSlideOffset;
683683
}

iOS-Slide-Menu.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
Pod::Spec.new do |s|
22
s.name = 'iOS-Slide-Menu'
3-
s.version = '1.4.6'
3+
s.version = '1.5'
44
s.summary = 'A Slide Menu for iOS'
55
s.homepage = 'https://github.com/aryaxt/iOS-Slide-Menu'
66
s.license = {
77
:type => 'MIT',
88
:file => 'License.txt'
99
}
1010
s.author = {'Aryan Ghassemi' => 'https://github.com/aryaxt/iOS-Slide-Menu'}
11-
s.source = {:git => 'https://github.com/aryaxt/iOS-Slide-Menu.git', :tag => '1.4.6'}
11+
s.source = {:git => 'https://github.com/aryaxt/iOS-Slide-Menu.git', :tag => '1.5'}
1212
s.platform = :ios, '6.0'
1313
s.source_files = 'SlideMenu/Source/*.{h,m}', 'SlideMenu/Source/Animations/*.{h,m}'
1414
s.resources = ['SlideMenu/Source/Assets/**/*']

0 commit comments

Comments
 (0)