Skip to content

Commit

Permalink
Added support for iPhone X
Browse files Browse the repository at this point in the history
  • Loading branch information
ipodishima committed Sep 13, 2017
1 parent c963b59 commit 7782838
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
static const CGFloat OFFSET_TRIGGER_CHANGE_DIRECTION = 0.0f;
static const CGFloat MAX_TRIGGER_OFFSET = 100.0f;

#define IS_IPHONE_X (PPScreenHeight() == 812.0f)
#define RAW_STATUS_BAR_HEIGHT (IS_IPHONE_X ? PPStatusBarHeight() : 20.0f)

#pragma mark -
@interface PPRevealSideViewController ()

Expand Down Expand Up @@ -715,7 +718,7 @@ - (UIView *)underStatusBarView
if (!PPSystemVersionGreaterOrEqualThan(7.0f)) return nil;

if (!_underStatusBarView && ([self isOptionEnabled:PPRevealSideOptionsiOS7StatusBarFading] || [self isOptionEnabled:PPRevealSideOptionsiOS7StatusBarMoving])) {
_underStatusBarView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(PPScreenBounds()), 20.0f)];
_underStatusBarView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(PPScreenBounds()), RAW_STATUS_BAR_HEIGHT)];
if ([self isOptionEnabled:PPRevealSideOptionsiOS7StatusBarFading]) {
_underStatusBarView.backgroundColor = self.fakeiOS7StatusBarColor;
}
Expand Down Expand Up @@ -877,7 +880,7 @@ - (void)resizeCurrentView {
}

if (_underStatusBarView) {
_underStatusBarView.frame = CGRectMake(0.0f, 0.0f, PPScreenWidth(), MIN(20.0f, PPStatusBarHeight()));
_underStatusBarView.frame = CGRectMake(0.0f, 0.0f, PPScreenWidth(), MIN(RAW_STATUS_BAR_HEIGHT, PPStatusBarHeight()));
}
}

Expand Down Expand Up @@ -1119,7 +1122,7 @@ - (CGRect)getSlidingRectForOffset:(CGFloat)offset forDirection:(PPRevealSideDire

- (CGRect)getSideViewFrameFromRootFrame:(CGRect)rootFrame andDirection:(PPRevealSideDirection)direction {
CGRect slideFrame = CGRectZero;
CGFloat yOffset = PPSystemVersionGreaterOrEqualThan(7.0f) ? 20.0f : 0.0f;
CGFloat yOffset = PPSystemVersionGreaterOrEqualThan(7.0f) ? RAW_STATUS_BAR_HEIGHT : 0.0f;

if ([self isOptionEnabled:PPRevealSideOptionsiOS7StatusBarMoving] || [self isOptionEnabled:PPRevealSideOptionsNoStatusBar]) {
yOffset = 0.0f;
Expand Down Expand Up @@ -1656,4 +1659,4 @@ - (UIEdgeInsets)revealSideInset {
return inset;
}

@end
@end

0 comments on commit 7782838

Please sign in to comment.