Skip to content

Commit 4aff9d1

Browse files
committed
Adjust the layout when viewWillAppear
Fixes issue with showing a modal, rotating, then dismissing the modal.
1 parent 71139e9 commit 4aff9d1

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

ECSlidingViewController/Vendor/ECSlidingViewController/ECSlidingViewController.m

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ - (NSUInteger)autoResizeToFillScreen;
2929
- (UIView *)topView;
3030
- (UIView *)underLeftView;
3131
- (UIView *)underRightView;
32+
- (void)adjustLayout;
3233
- (void)updateTopViewHorizontalCenterWithRecognizer:(UIPanGestureRecognizer *)recognizer;
3334
- (void)updateTopViewHorizontalCenter:(CGFloat)newHorizontalCenter;
3435
- (void)topViewHorizontalCenterWillChange:(CGFloat)newHorizontalCenter;
@@ -176,8 +177,7 @@ - (void)viewDidLoad
176177
- (void)viewWillAppear:(BOOL)animated
177178
{
178179
[super viewWillAppear:animated];
179-
[self updateUnderLeftLayout];
180-
[self updateUnderRightLayout];
180+
[self adjustLayout];
181181
}
182182

183183
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
@@ -186,6 +186,17 @@ - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInte
186186
[self removeTopViewSnapshot];
187187
}
188188

189+
[self adjustLayout];
190+
}
191+
192+
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
193+
if(![self topViewHasFocus]){
194+
[self addTopViewSnapshot];
195+
}
196+
}
197+
198+
- (void)adjustLayout
199+
{
189200
if ([self underRightShowing] && ![self topViewIsOffScreen]) {
190201
[self updateUnderRightLayout];
191202
[self updateTopViewHorizontalCenter:self.anchorLeftTopViewCenter];
@@ -201,12 +212,6 @@ - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInte
201212
}
202213
}
203214

204-
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
205-
if(![self topViewHasFocus]){
206-
[self addTopViewSnapshot];
207-
}
208-
}
209-
210215
- (void)updateTopViewHorizontalCenterWithRecognizer:(UIPanGestureRecognizer *)recognizer
211216
{
212217
CGPoint currentTouchPoint = [recognizer locationInView:self.view];

0 commit comments

Comments
 (0)