@@ -171,9 +171,9 @@ - (void)setUnderRightViewController:(UIViewController *)theUnderRightViewControl
171
171
172
172
- (void )setUnderLeftWidthLayout : (ECViewWidthLayout)underLeftWidthLayout
173
173
{
174
- if (underLeftWidthLayout == ECVariableRevealWidth && self.anchorRightPeekAmount <= 0 ) {
174
+ if (underLeftWidthLayout == ECVariableRevealWidth && self.anchorRightPeekAmount <= 0 . 0f ) {
175
175
[NSException raise: @" Invalid Width Layout" format: @" anchorRightPeekAmount must be set" ];
176
- } else if (underLeftWidthLayout == ECFixedRevealWidth && self.anchorRightRevealAmount <= 0 ) {
176
+ } else if (underLeftWidthLayout == ECFixedRevealWidth && self.anchorRightRevealAmount <= 0 . 0f ) {
177
177
[NSException raise: @" Invalid Width Layout" format: @" anchorRightRevealAmount must be set" ];
178
178
}
179
179
@@ -182,9 +182,9 @@ - (void)setUnderLeftWidthLayout:(ECViewWidthLayout)underLeftWidthLayout
182
182
183
183
- (void )setUnderRightWidthLayout : (ECViewWidthLayout)underRightWidthLayout
184
184
{
185
- if (underRightWidthLayout == ECVariableRevealWidth && self.anchorLeftPeekAmount <= 0 ) {
185
+ if (underRightWidthLayout == ECVariableRevealWidth && self.anchorLeftPeekAmount <= 0 . 0f ) {
186
186
[NSException raise: @" Invalid Width Layout" format: @" anchorLeftPeekAmount must be set" ];
187
- } else if (underRightWidthLayout == ECFixedRevealWidth && self.anchorLeftRevealAmount <= 0 ) {
187
+ } else if (underRightWidthLayout == ECFixedRevealWidth && self.anchorLeftRevealAmount <= 0 . 0f ) {
188
188
[NSException raise: @" Invalid Width Layout" format: @" anchorLeftRevealAmount must be set" ];
189
189
}
190
190
@@ -250,7 +250,7 @@ - (void)adjustLayout
250
250
} else if ([self underLeftShowing ] && [self topViewIsOffScreen ]) {
251
251
[self updateUnderLeftLayout ];
252
252
self.topViewController .view .frame = [self fullViewBounds ];
253
- [self updateTopViewHorizontalCenter: self .view.bounds.size.width + self .resettedCenter];
253
+ [self updateTopViewHorizontalCenter: CGRectGetWidth ( self .view.bounds) + self .resettedCenter];
254
254
} else {
255
255
self.topViewController .view .frame = [self fullViewBounds ];
256
256
}
@@ -304,8 +304,8 @@ - (UIView *)statusBarBackgroundView
304
304
CGRect statusBarFrame = [UIApplication sharedApplication ].statusBarFrame ;
305
305
306
306
if (UIInterfaceOrientationIsLandscape ([UIApplication sharedApplication ].statusBarOrientation )) {
307
- CGFloat width = statusBarFrame. size . height ;
308
- CGFloat height = statusBarFrame. size . width ;
307
+ CGFloat width = CGRectGetHeight ( statusBarFrame) ;
308
+ CGFloat height = CGRectGetWidth ( statusBarFrame) ;
309
309
statusBarFrame.size .width = width;
310
310
statusBarFrame.size .height = height;
311
311
}
@@ -383,7 +383,7 @@ - (void)anchorTopViewOffScreenTo:(ECSide)side animations:(void(^)())animations o
383
383
if (side == ECLeft) {
384
384
newCenter = -self.resettedCenter ;
385
385
} else if (side == ECRight) {
386
- newCenter = self.view .bounds . size . width + self.resettedCenter ;
386
+ newCenter = CGRectGetWidth ( self.view .bounds ) + self.resettedCenter ;
387
387
}
388
388
389
389
[self topViewHorizontalCenterWillChange: newCenter];
@@ -533,7 +533,7 @@ - (void)removeTopViewSnapshot
533
533
- (CGFloat)anchorRightTopViewCenter
534
534
{
535
535
if (self.anchorRightPeekAmount ) {
536
- return self.view .bounds . size . width + self.resettedCenter - self.anchorRightPeekAmount ;
536
+ return CGRectGetWidth ( self.view .bounds ) + self.resettedCenter - self.anchorRightPeekAmount ;
537
537
} else if (self.anchorRightRevealAmount ) {
538
538
return self.resettedCenter + self.anchorRightRevealAmount ;
539
539
} else {
@@ -546,38 +546,41 @@ - (CGFloat)anchorLeftTopViewCenter
546
546
if (self.anchorLeftPeekAmount ) {
547
547
return -self.resettedCenter + self.anchorLeftPeekAmount ;
548
548
} else if (self.anchorLeftRevealAmount ) {
549
- return -self.resettedCenter + (self.view .bounds . size . width - self.anchorLeftRevealAmount );
549
+ return -self.resettedCenter + (CGRectGetWidth ( self.view .bounds ) - self.anchorLeftRevealAmount );
550
550
} else {
551
551
return NSNotFound ;
552
552
}
553
553
}
554
554
555
555
- (CGFloat)resettedCenter
556
556
{
557
- return (self.view .bounds . size . width / 2 );
557
+ return (CGRectGetWidth ( self.view .bounds ) / 2 . 0f );
558
558
}
559
559
560
560
- (CGRect)fullViewBounds
561
561
{
562
- CGFloat statusBarHeight = 0 ;
563
-
564
- BOOL legacyScreenHeightEnabled = NO ;
565
- if (floor (NSFoundationVersionNumber ) <= 993.00 ) {
566
- legacyScreenHeightEnabled = YES ;
567
- }
562
+ CGFloat statusBarHeight = 0 .0f ;
563
+
564
+ /* *
565
+ Enable legacy screen height support if we are running on an SDK prior to iOS 6
566
+ and thus does not support the supportedInterfaceOrientationsForWindow: selector on
567
+ UIApplication, which was introduced in iOS 6
568
+ */
569
+ UIApplication *sharedApplication = [UIApplication sharedApplication ];
570
+ BOOL legacyScreenHeightEnabled = ![sharedApplication respondsToSelector: @selector (supportedInterfaceOrientationsForWindow: )];
568
571
569
572
if (self.shouldAdjustChildViewHeightForStatusBar || legacyScreenHeightEnabled) {
570
- statusBarHeight = [UIApplication sharedApplication ] .statusBarFrame .size .height ;
571
- if (UIInterfaceOrientationIsLandscape ([UIApplication sharedApplication ] .statusBarOrientation )) {
572
- statusBarHeight = [UIApplication sharedApplication ] .statusBarFrame .size .width ;
573
+ statusBarHeight = sharedApplication.statusBarFrame .size .height ;
574
+ if (UIInterfaceOrientationIsLandscape (sharedApplication.statusBarOrientation )) {
575
+ statusBarHeight = sharedApplication.statusBarFrame .size .width ;
573
576
}
574
577
}
575
578
576
579
CGRect bounds = [UIScreen mainScreen ].bounds ;
577
580
578
- if (UIInterfaceOrientationIsLandscape ([UIApplication sharedApplication ] .statusBarOrientation )) {
579
- CGFloat height = bounds. size . width ;
580
- CGFloat width = bounds. size . height ;
581
+ if (UIInterfaceOrientationIsLandscape (sharedApplication.statusBarOrientation )) {
582
+ CGFloat height = CGRectGetWidth ( bounds) ;
583
+ CGFloat width = CGRectGetHeight ( bounds) ;
581
584
bounds.size .height = height;
582
585
bounds.size .width = width;
583
586
}
@@ -645,7 +648,7 @@ - (void)updateUnderLeftLayout
645
648
} else if (self.underLeftWidthLayout == ECVariableRevealWidth && !self.topViewIsOffScreen ) {
646
649
CGRect frame = [self fullViewBounds ];
647
650
648
- frame.size .width = frame. size . width - self.anchorRightPeekAmount ;
651
+ frame.size .width -= self.anchorRightPeekAmount ;
649
652
self.underLeftView .frame = frame;
650
653
} else if (self.underLeftWidthLayout == ECFixedRevealWidth) {
651
654
CGRect frame = [self fullViewBounds ];
@@ -666,10 +669,10 @@ - (void)updateUnderRightLayout
666
669
CGRect frame = [self fullViewBounds ];
667
670
668
671
CGFloat newLeftEdge;
669
- CGFloat newWidth = frame. size . width ;
672
+ CGFloat newWidth = CGRectGetWidth ( frame) ;
670
673
671
674
if (self.topViewIsOffScreen ) {
672
- newLeftEdge = 0 ;
675
+ newLeftEdge = 0 . 0f ;
673
676
} else {
674
677
newLeftEdge = self.anchorLeftPeekAmount ;
675
678
newWidth -= self.anchorLeftPeekAmount ;
@@ -682,7 +685,7 @@ - (void)updateUnderRightLayout
682
685
} else if (self.underRightWidthLayout == ECFixedRevealWidth) {
683
686
CGRect frame = [self fullViewBounds ];
684
687
685
- CGFloat newLeftEdge = frame. size . width - self.anchorLeftRevealAmount ;
688
+ CGFloat newLeftEdge = CGRectGetWidth ( frame) - self.anchorLeftRevealAmount ;
686
689
CGFloat newWidth = self.anchorLeftRevealAmount ;
687
690
688
691
frame.origin .x = newLeftEdge;
0 commit comments