@@ -43,8 +43,6 @@ - (void)removeTopViewSnapshot;
43
43
- (CGFloat)anchorRightTopViewCenter ;
44
44
- (CGFloat)anchorLeftTopViewCenter ;
45
45
- (CGFloat)resettedCenter ;
46
- - (CGFloat)screenWidth ;
47
- - (CGFloat)screenWidthForOrientation : (UIInterfaceOrientation)orientation ;
48
46
- (void )underLeftWillAppear ;
49
47
- (void )underRightWillAppear ;
50
48
- (void )topDidReset ;
@@ -242,7 +240,7 @@ - (void)adjustLayout
242
240
[self updateTopViewHorizontalCenter: self .anchorRightTopViewCenter];
243
241
} else if ([self underLeftShowing ] && [self topViewIsOffScreen ]) {
244
242
[self updateUnderLeftLayout ];
245
- [self updateTopViewHorizontalCenter: self .screenWidth + self .resettedCenter];
243
+ [self updateTopViewHorizontalCenter: self .view.bounds.size.width + self .resettedCenter];
246
244
}
247
245
}
248
246
@@ -340,7 +338,7 @@ - (void)anchorTopViewOffScreenTo:(ECSide)side animations:(void(^)())animations o
340
338
if (side == ECLeft) {
341
339
newCenter = -self.resettedCenter ;
342
340
} else if (side == ECRight) {
343
- newCenter = self.screenWidth + self.resettedCenter ;
341
+ newCenter = self.view . bounds . size . width + self.resettedCenter ;
344
342
}
345
343
346
344
[self topViewHorizontalCenterWillChange: newCenter];
@@ -477,7 +475,7 @@ - (void)removeTopViewSnapshot
477
475
- (CGFloat)anchorRightTopViewCenter
478
476
{
479
477
if (self.anchorRightPeekAmount ) {
480
- return self.screenWidth + self.resettedCenter - self.anchorRightPeekAmount ;
478
+ return self.view . bounds . size . width + self.resettedCenter - self.anchorRightPeekAmount ;
481
479
} else if (self.anchorRightRevealAmount ) {
482
480
return self.resettedCenter + self.anchorRightRevealAmount ;
483
481
} else {
@@ -490,35 +488,15 @@ - (CGFloat)anchorLeftTopViewCenter
490
488
if (self.anchorLeftPeekAmount ) {
491
489
return -self.resettedCenter + self.anchorLeftPeekAmount ;
492
490
} else if (self.anchorLeftRevealAmount ) {
493
- return -self.resettedCenter + (self.screenWidth - self.anchorLeftRevealAmount );
491
+ return -self.resettedCenter + (self.view . bounds . size . width - self.anchorLeftRevealAmount );
494
492
} else {
495
493
return NSNotFound ;
496
494
}
497
495
}
498
496
499
497
- (CGFloat)resettedCenter
500
498
{
501
- return ceil (self.screenWidth / 2 );
502
- }
503
-
504
- - (CGFloat)screenWidth
505
- {
506
- return [self screenWidthForOrientation: [UIApplication sharedApplication ].statusBarOrientation];
507
- }
508
-
509
- - (CGFloat)screenWidthForOrientation : (UIInterfaceOrientation)orientation
510
- {
511
- CGSize size = [UIScreen mainScreen ].bounds .size ;
512
- UIApplication *application = [UIApplication sharedApplication ];
513
- if (UIInterfaceOrientationIsLandscape (orientation))
514
- {
515
- size = CGSizeMake (size.height , size.width );
516
- }
517
- if (application.statusBarHidden == NO )
518
- {
519
- size.height -= MIN (application.statusBarFrame .size .width , application.statusBarFrame .size .height );
520
- }
521
- return size.width ;
499
+ return (self.view .bounds .size .width / 2 );
522
500
}
523
501
524
502
- (void )underLeftWillAppear
@@ -574,16 +552,8 @@ - (void)updateUnderLeftLayout
574
552
[self .underLeftView setFrame: self .view.bounds];
575
553
} else if (self.underLeftWidthLayout == ECVariableRevealWidth && !self.topViewIsOffScreen ) {
576
554
CGRect frame = self.view .bounds ;
577
- CGFloat newWidth;
578
-
579
- if (UIInterfaceOrientationIsLandscape ([UIApplication sharedApplication ].statusBarOrientation )) {
580
- newWidth = [UIScreen mainScreen ].bounds .size .height - self.anchorRightPeekAmount ;
581
- } else {
582
- newWidth = [UIScreen mainScreen ].bounds .size .width - self.anchorRightPeekAmount ;
583
- }
584
-
585
- frame.size .width = newWidth;
586
555
556
+ frame.size .width = frame.size .width - self.anchorRightPeekAmount ;
587
557
self.underLeftView .frame = frame;
588
558
} else if (self.underLeftWidthLayout == ECFixedRevealWidth) {
589
559
CGRect frame = self.view .bounds ;
@@ -604,13 +574,7 @@ - (void)updateUnderRightLayout
604
574
CGRect frame = self.view .bounds ;
605
575
606
576
CGFloat newLeftEdge;
607
- CGFloat newWidth;
608
-
609
- if (UIInterfaceOrientationIsLandscape ([UIApplication sharedApplication ].statusBarOrientation )) {
610
- newWidth = [UIScreen mainScreen ].bounds .size .height ;
611
- } else {
612
- newWidth = [UIScreen mainScreen ].bounds .size .width ;
613
- }
577
+ CGFloat newWidth = frame.size .width ;
614
578
615
579
if (self.topViewIsOffScreen ) {
616
580
newLeftEdge = 0 ;
@@ -626,7 +590,7 @@ - (void)updateUnderRightLayout
626
590
} else if (self.underRightWidthLayout == ECFixedRevealWidth) {
627
591
CGRect frame = self.view .bounds ;
628
592
629
- CGFloat newLeftEdge = self. screenWidth - self.anchorLeftRevealAmount ;
593
+ CGFloat newLeftEdge = frame. size . width - self.anchorLeftRevealAmount ;
630
594
CGFloat newWidth = self.anchorLeftRevealAmount ;
631
595
632
596
frame.origin .x = newLeftEdge;
0 commit comments