Adjust the layout when viewWillAppear

Fixes issue with showing a modal, rotating, then dismissing the modal.
This commit is contained in:
Mike Enriquez
2012-03-20 16:50:42 -04:00
parent 71139e987b
commit 4aff9d1333

View File

@@ -29,6 +29,7 @@ NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidReset";
- (UIView *)topView;
- (UIView *)underLeftView;
- (UIView *)underRightView;
- (void)adjustLayout;
- (void)updateTopViewHorizontalCenterWithRecognizer:(UIPanGestureRecognizer *)recognizer;
- (void)updateTopViewHorizontalCenter:(CGFloat)newHorizontalCenter;
- (void)topViewHorizontalCenterWillChange:(CGFloat)newHorizontalCenter;
@@ -176,8 +177,7 @@ NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidReset";
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self updateUnderLeftLayout];
[self updateUnderRightLayout];
[self adjustLayout];
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
@@ -186,6 +186,17 @@ NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidReset";
[self removeTopViewSnapshot];
}
[self adjustLayout];
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
if(![self topViewHasFocus]){
[self addTopViewSnapshot];
}
}
- (void)adjustLayout
{
if ([self underRightShowing] && ![self topViewIsOffScreen]) {
[self updateUnderRightLayout];
[self updateTopViewHorizontalCenter:self.anchorLeftTopViewCenter];
@@ -201,12 +212,6 @@ NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidReset";
}
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
if(![self topViewHasFocus]){
[self addTopViewSnapshot];
}
}
- (void)updateTopViewHorizontalCenterWithRecognizer:(UIPanGestureRecognizer *)recognizer
{
CGPoint currentTouchPoint = [recognizer locationInView:self.view];