@@ -21,6 +21,9 @@ @interface ECSlidingViewController()
21
21
@property (nonatomic , unsafe_unretained) CGFloat initialHoizontalCenter;
22
22
@property (nonatomic , strong ) UIPanGestureRecognizer *panGesture;
23
23
@property (nonatomic , strong ) UITapGestureRecognizer *resetTapGesture;
24
+ @property (nonatomic , unsafe_unretained) BOOL underLeftShowing;
25
+ @property (nonatomic , unsafe_unretained) BOOL underRightShowing;
26
+ @property (nonatomic , unsafe_unretained) BOOL topViewIsOffScreen;
24
27
25
28
- (NSUInteger )autoResizeToFillScreen ;
26
29
- (UIView *)topView ;
@@ -81,6 +84,9 @@ @implementation ECSlidingViewController
81
84
@synthesize initialHoizontalCenter;
82
85
@synthesize panGesture = _panGesture;
83
86
@synthesize resetTapGesture;
87
+ @synthesize underLeftShowing = _underLeftShowing;
88
+ @synthesize underRightShowing = _underRightShowing;
89
+ @synthesize topViewIsOffScreen = _topViewIsOffScreen;
84
90
85
91
- (void )setTopViewController : (UIViewController *)theTopViewController
86
92
{
@@ -270,7 +276,7 @@ - (void)anchorTopViewTo:(ECSide)side animations:(void (^)())animations onComplet
270
276
if (complete) {
271
277
complete ();
272
278
}
273
-
279
+ _topViewIsOffScreen = NO ;
274
280
[self addTopViewSnapshot ];
275
281
dispatch_async (dispatch_get_main_queue (), ^{
276
282
NSString *key = (side == ECLeft) ? ECSlidingViewTopDidAnchorLeft : ECSlidingViewTopDidAnchorRight;
@@ -305,6 +311,7 @@ - (void)anchorTopViewOffScreenTo:(ECSide)side animations:(void(^)())animations o
305
311
if (complete) {
306
312
complete ();
307
313
}
314
+ _topViewIsOffScreen = YES ;
308
315
[self addTopViewSnapshot ];
309
316
dispatch_async (dispatch_get_main_queue (), ^{
310
317
NSString *key = (side == ECLeft) ? ECSlidingViewTopDidAnchorLeft : ECSlidingViewTopDidAnchorRight;
@@ -333,21 +340,6 @@ - (void)resetTopViewWithAnimations:(void(^)())animations onComplete:(void(^)())c
333
340
}];
334
341
}
335
342
336
- - (BOOL )underLeftShowing
337
- {
338
- return self.topView .frame .origin .x > 0 ;
339
- }
340
-
341
- - (BOOL )underRightShowing
342
- {
343
- return self.topView .frame .origin .x < 0 ;
344
- }
345
-
346
- - (BOOL )topViewIsOffScreen
347
- {
348
- return self.topView .center .x <= -self.resettedCenter + 1 || self.topView .center .x >= self.screenWidth + self.resettedCenter - 1 ;
349
- }
350
-
351
343
- (NSUInteger )autoResizeToFillScreen
352
344
{
353
345
return (UIViewAutoresizingFlexibleWidth |
@@ -472,6 +464,8 @@ - (void)underLeftWillAppear
472
464
[self .underLeftViewController viewWillAppear: NO ];
473
465
self.underLeftView .hidden = NO ;
474
466
[self updateUnderLeftLayout ];
467
+ _underLeftShowing = YES ;
468
+ _underRightShowing = NO ;
475
469
}
476
470
477
471
- (void )underRightWillAppear
@@ -483,6 +477,8 @@ - (void)underRightWillAppear
483
477
[self .underRightViewController viewWillAppear: NO ];
484
478
self.underRightView .hidden = NO ;
485
479
[self updateUnderRightLayout ];
480
+ _underLeftShowing = NO ;
481
+ _underRightShowing = YES ;
486
482
}
487
483
488
484
- (void )topDidReset
@@ -493,6 +489,9 @@ - (void)topDidReset
493
489
[self .topView removeGestureRecognizer: self .resetTapGesture];
494
490
[self removeTopViewSnapshot ];
495
491
self.panGesture .enabled = YES ;
492
+ _underLeftShowing = NO ;
493
+ _underRightShowing = NO ;
494
+ _topViewIsOffScreen = NO ;
496
495
}
497
496
498
497
- (BOOL )topViewHasFocus
0 commit comments