@@ -33,11 +33,11 @@ @implementation SlideNavigationContorllerAnimatorSlide
3333
3434- (id )init
3535{
36- if (self = [self initWithSlideMovement: 100 ])
37- {
38- }
39-
40- return self;
36+ if (self = [self initWithSlideMovement: 100 ])
37+ {
38+ }
39+
40+ return self;
4141}
4242
4343- (id )initWithSlideMovement : (CGFloat)slideMovement
@@ -55,98 +55,119 @@ - (id)initWithSlideMovement:(CGFloat)slideMovement
5555- (void )prepareMenuForAnimation : (Menu)menu
5656{
5757UIViewController *menuViewController = (menu == MenuLeft)
58- ? [SlideNavigationController sharedInstance ].leftMenu
59- : [SlideNavigationController sharedInstance ].rightMenu ;
58+ ? [SlideNavigationController sharedInstance ].leftMenu
59+ : [SlideNavigationController sharedInstance ].rightMenu ;
6060
6161UIInterfaceOrientation orientation= [SlideNavigationController sharedInstance ].interfaceOrientation ;
6262CGRect rect = menuViewController.view .frame ;
6363
64- if (UIInterfaceOrientationIsLandscape (orientation))
65- {
66- if (orientation == UIInterfaceOrientationLandscapeRight)
67- {
68- rect.origin .y = (menu == MenuLeft) ? self.slideMovement *-1 : self.slideMovement ;
69- }
70- else
71- {
72- rect.origin .y = (menu == MenuRight) ? self.slideMovement *-1 : self.slideMovement ;
73- }
74- }
75- else
76- {
77- if (orientation == UIInterfaceOrientationPortrait)
78- {
79- rect.origin .x = (menu == MenuLeft) ? self.slideMovement *-1 : self.slideMovement ;
80- }
81- else
82- {
83- rect.origin .x = (menu == MenuRight) ? self.slideMovement *-1 : self.slideMovement ;
84- }
85- }
86-
87- menuViewController.view .frame = rect;
64+ if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO (@" 8.0" ))
65+ {
66+ rect.origin .x = self.slideMovement ;
67+ }
68+ else
69+ {
70+ if (UIInterfaceOrientationIsLandscape (orientation))
71+ {
72+ if (orientation == UIInterfaceOrientationLandscapeRight)
73+ {
74+ rect.origin .y = (menu == MenuLeft) ? self.slideMovement *-1 : self.slideMovement ;
75+ }
76+ else
77+ {
78+ rect.origin .y = (menu == MenuRight) ? self.slideMovement *-1 : self.slideMovement ;
79+ }
80+ }
81+ else
82+ {
83+ if (orientation == UIInterfaceOrientationPortrait)
84+ {
85+ rect.origin .x = (menu == MenuLeft) ? self.slideMovement *-1 : self.slideMovement ;
86+ }
87+ else
88+ {
89+ rect.origin .x = (menu == MenuRight) ? self.slideMovement *-1 : self.slideMovement ;
90+ }
91+ }
92+ }
93+
94+ menuViewController.view .frame = rect;
8895}
8996
9097- (void )animateMenu : (Menu)menu withProgress : (CGFloat)progress
9198{
92- UIViewController *menuViewController = (menu == MenuLeft)
93- ? [SlideNavigationController sharedInstance ].leftMenu
94- : [SlideNavigationController sharedInstance ].rightMenu ;
95-
96- UIInterfaceOrientation orientation= [SlideNavigationController sharedInstance ].interfaceOrientation ;
97-
98- NSInteger location = (menu == MenuLeft)
99- ? (self.slideMovement * -1 ) + (self.slideMovement * progress)
100- : (self.slideMovement * (1 -progress));
101-
102- if (menu == MenuLeft)
103- location = (location > 0 ) ? 0 : location;
104-
105- if (menu == MenuRight)
106- location = (location < 0 ) ? 0 : location;
107-
108- CGRect rect = menuViewController.view .frame ;
109-
110- if (UIInterfaceOrientationIsLandscape (orientation))
111- {
112- rect.origin .y = (orientation == UIInterfaceOrientationLandscapeRight) ? location : location*-1 ;
113- }
114- else
115- {
116- rect.origin .x = (orientation == UIInterfaceOrientationPortrait) ? location : location*-1 ;
117- }
118-
119- menuViewController.view .frame = rect;
99+ UIViewController *menuViewController = (menu == MenuLeft)
100+ ? [SlideNavigationController sharedInstance ].leftMenu
101+ : [SlideNavigationController sharedInstance ].rightMenu ;
102+
103+ UIInterfaceOrientation orientation = [SlideNavigationController sharedInstance ].interfaceOrientation ;
104+
105+ NSInteger location = (menu == MenuLeft)
106+ ? (self.slideMovement * -1 ) + (self.slideMovement * progress)
107+ : (self.slideMovement * (1 -progress));
108+
109+ if (menu == MenuLeft)
110+ location = (location > 0 ) ? 0 : location;
111+
112+ if (menu == MenuRight)
113+ location = (location < 0 ) ? 0 : location;
114+
115+ CGRect rect = menuViewController.view .frame ;
116+
117+ if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO (@" 8.0" ))
118+ {
119+ rect.origin .x = location;
120+ }
121+ else
122+ {
123+ if (UIInterfaceOrientationIsLandscape (orientation))
124+ {
125+ rect.origin .y = (orientation == UIInterfaceOrientationLandscapeRight) ? location : location*-1 ;
126+ }
127+ else
128+ {
129+ rect.origin .x = (orientation == UIInterfaceOrientationPortrait) ? location : location*-1 ;
130+ }
131+ }
132+
133+ menuViewController.view .frame = rect;
120134}
121135
122136- (void )clear
123137{
124- [self clearMenu: MenuLeft];
125- [self clearMenu: MenuRight];
138+ [self clearMenu: MenuLeft];
139+ [self clearMenu: MenuRight];
126140}
127141
128142#pragma mark - Private Method -
129143
130144- (void )clearMenu : (Menu)menu
131145{
132- UIViewController *menuViewController = (menu == MenuLeft)
133- ? [SlideNavigationController sharedInstance ].leftMenu
134- : [SlideNavigationController sharedInstance ].rightMenu ;
135-
136- UIInterfaceOrientation orientation= [SlideNavigationController sharedInstance ].interfaceOrientation ;
137-
138- CGRect rect = menuViewController.view .frame ;
139-
140- if (UIInterfaceOrientationIsLandscape (orientation))
141- {
142- rect.origin .y = 0 ;
143- }
144- else
145- {
146- rect.origin .x = 0 ;
147- }
148-
149- menuViewController.view .frame = rect;
146+ UIViewController *menuViewController = (menu == MenuLeft)
147+ ? [SlideNavigationController sharedInstance ].leftMenu
148+ : [SlideNavigationController sharedInstance ].rightMenu ;
149+
150+ UIInterfaceOrientation orientation= [SlideNavigationController sharedInstance ].interfaceOrientation ;
151+
152+ CGRect rect = menuViewController.view .frame ;
153+
154+ if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO (@" 8.0" ))
155+ {
156+ rect.origin .x = 0 ;
157+ }
158+ else
159+ {
160+ if (UIInterfaceOrientationIsLandscape (orientation))
161+ {
162+ rect.origin .y = 0 ;
163+ }
164+ else
165+ {
166+ rect.origin .x = 0 ;
167+ }
168+ }
169+
170+ menuViewController.view .frame = rect;
150171}
151172
152173@end
0 commit comments