mirror of
https://github.com/zhigang1992/ECSlidingViewController.git
synced 2026-03-27 22:49:37 +08:00
Adjust the layout when viewWillAppear
Fixes issue with showing a modal, rotating, then dismissing the modal.
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user