Skip to content

Commit 0bd122a

Browse files
committed
it's better with the file
1 parent 5dddf5b commit 0bd122a

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

PPRevealSideViewController/PPRevealSideviewController/PPRevealSideViewController.m

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ - (void) pushViewController:(UIViewController *)controller onDirection:(PPReveal
206206
// save the controller and remove the old one from the view
207207
UIViewController *oldController = [_viewControllers objectForKey:directionNumber];
208208
if (controller != oldController) {
209+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [oldController viewWillDisappear:animated];
209210
[oldController.view removeFromSuperview];
210211
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [oldController viewDidDisappear:animated];
211212
}
@@ -217,9 +218,14 @@ - (void) pushViewController:(UIViewController *)controller onDirection:(PPReveal
217218
// Place the controller juste below the rootviewcontroller
218219
controller.view.frame = self.view.bounds; // handle layout issue with navigation bar. Comment to see the crap, then push a nav controller
219220

221+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [controller viewWillDisappear:animated];
220222
[controller.view removeFromSuperview];
223+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [controller viewDidDisappear:animated];
224+
225+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [controller viewWillAppear:animated];
221226
[self.view insertSubview:controller.view belowSubview:_rootViewController.view];
222-
227+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [controller viewDidAppear:animated];
228+
223229
// if bounces is activated and the push is animated, calculate the first frame with the bounce
224230
CGRect rootFrame = CGRectZero;
225231
if ([self canCrossOffsets] && animated) // then we make an offset
@@ -321,7 +327,10 @@ - (void) popViewControllerWithNewCenterController:(UIViewController *)centerCont
321327

322328
// remove the view (don't need to surcharge (not english this word ? ... ) all the interface).
323329
UIViewController *oldController = (UIViewController*)[_viewControllers objectForKey:[NSNumber numberWithInt:directionToClose]];
330+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [oldController viewWillDisappear:animated];
324331
[oldController.view removeFromSuperview];
332+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [oldController viewDidDisappear:animated];
333+
325334

326335
_animationInProgress = NO;
327336

@@ -493,7 +502,10 @@ - (void) setRootViewController:(UIViewController *)controller {
493502

494503
[self removeAllGestures];
495504

505+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [_rootViewController viewWillDisappear:NO];
496506
[_rootViewController.view removeFromSuperview];
507+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [_rootViewController viewDidDisappear:NO];
508+
497509

498510
[_rootViewController removeObserver:self forKeyPath:@"view.frame"];
499511

@@ -506,8 +518,10 @@ - (void) setRootViewController:(UIViewController *)controller {
506518
context:NULL];
507519
[self handleShadows];
508520

521+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [_rootViewController viewWillAppear:NO];
509522
[self.view addSubview:_rootViewController.view];
510-
523+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [_rootViewController viewDidAppear:NO];
524+
511525
[self addGesturesToController:_rootViewController];
512526

513527
[self didChangeValueForKey:@"rootViewController"];
@@ -881,7 +895,9 @@ - (void) gestureRecognizerDidPan:(UIPanGestureRecognizer*)panGesture {
881895
if (!c.view.superview)
882896
{
883897
c.view.frame = self.rootViewController.view.bounds;
898+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [c viewWillAppear:NO];
884899
[self.view insertSubview:c.view belowSubview:_rootViewController.view];
900+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [c viewDidAppear:NO];
885901
}
886902
}
887903
else // we use the bounce animation
@@ -924,7 +940,11 @@ - (void) gestureRecognizerDidPan:(UIPanGestureRecognizer*)panGesture {
924940
newDirection = PPRevealSideDirectionLeft;
925941

926942
if ([_viewControllers objectForKey:[NSNumber numberWithInt:newDirection]]) {
927-
[[[_viewControllers objectForKey:[NSNumber numberWithInt:_currentPanDirection]] view] removeFromSuperview];
943+
UIViewController *c = [_viewControllers objectForKey:[NSNumber numberWithInt:_currentPanDirection]];
944+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [c viewWillDisappear:NO];
945+
[c.view removeFromSuperview];
946+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [c viewDidDisappear:NO];
947+
928948
_currentPanDirection = newDirection;
929949
_wasClosed = !_wasClosed;
930950
return;
@@ -944,8 +964,10 @@ - (void) gestureRecognizerDidPan:(UIPanGestureRecognizer*)panGesture {
944964
newDirection = PPRevealSideDirectionBottom;
945965

946966
if ([_viewControllers objectForKey:[NSNumber numberWithInt:newDirection]]) {
947-
[[[_viewControllers objectForKey:[NSNumber numberWithInt:_currentPanDirection]] view] removeFromSuperview];
948-
_currentPanDirection = newDirection;
967+
UIViewController *c = [_viewControllers objectForKey:[NSNumber numberWithInt:_currentPanDirection]];
968+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [c viewWillDisappear:NO];
969+
[c.view removeFromSuperview];
970+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5.0) [c viewDidDisappear:NO]; _currentPanDirection = newDirection;
949971
_wasClosed = !_wasClosed;
950972
return;
951973
}

0 commit comments

Comments
 (0)