Skip to content

Commit

Permalink
changes in appearance method behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Joan Lluch committed Apr 22, 2015
1 parent f816bc0 commit b2f3d53
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions SWRevealViewController/SWRevealViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,20 @@ - (void)prepareRightViewForPosition:(FrontViewPosition)newPosition
}


- (void)unloadRearView
{
[_rearView removeFromSuperview];
_rearView = nil;
}


- (void)unloadRightView
{
[_rightView removeFromSuperview];
_rightView = nil;
}


- (CGFloat)frontLocationForPosition:(FrontViewPosition)frontViewPosition
{
CGFloat revealWidth;
Expand Down Expand Up @@ -1540,7 +1554,17 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV

_rearViewPosition = newPosition;

return [self _deploymentForViewController:_rearViewController inView:_contentView.rearView appear:appear disappear:disappear];
void (^deploymentCompletion)() =
[self _deploymentForViewController:_rearViewController inView:_contentView.rearView appear:appear disappear:disappear];

void (^completion)() = ^()
{
deploymentCompletion();
if ( disappear )
[_contentView unloadRearView];
};

return completion;
}

// Deploy/Undeploy of the right view controller following the containment principles. Returns a block
Expand All @@ -1558,7 +1582,17 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV

_rightViewPosition = newPosition;

return [self _deploymentForViewController:_rightViewController inView:_contentView.rightView appear:appear disappear:disappear];
void (^deploymentCompletion)() =
[self _deploymentForViewController:_rightViewController inView:_contentView.rightView appear:appear disappear:disappear];

void (^completion)() = ^()
{
deploymentCompletion();
if ( disappear )
[_contentView unloadRightView];
};

return completion;
}


Expand Down

0 comments on commit b2f3d53

Please sign in to comment.