Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #91 : Need layout adaptations for iPhone X #92

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions WYPopoverController/WYPopoverController.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ of this software and associated documentation files (the "Software"), to deal
#define WY_BASE_SDK_7_ENABLED
#endif

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
#define WY_BASE_SDK_8_ENABLED
#endif

#ifdef DEBUG
#define WY_LOG(fmt, ...) NSLog((@"%s (%d) : " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
Expand Down Expand Up @@ -2094,10 +2098,17 @@ - (void)positionPopover:(BOOL)aAnimated {

viewFrame = WYRectInWindowBounds(viewFrame, orientation);

#ifdef WY_BASE_SDK_8_ENABLED
minX = MAX(_popoverLayoutMargins.left, _inView.layoutMargins.left);
maxX = overlayWidth - MAX(_popoverLayoutMargins.right, _inView.layoutMargins.right);
minY = MAX(_popoverLayoutMargins.top, _inView.layoutMargins.top);
maxY = overlayHeight - MAX(_popoverLayoutMargins.bottom, _inView.layoutMargins.bottom) - keyboardHeight;
#else
minX = _popoverLayoutMargins.left;
maxX = overlayWidth - _popoverLayoutMargins.right;
minY = WYStatusBarHeight() + _popoverLayoutMargins.top;
maxY = overlayHeight - _popoverLayoutMargins.bottom - keyboardHeight;
#endif

// Which direction ?
//
Expand Down Expand Up @@ -2664,10 +2675,17 @@ - (CGSize)sizeForRect:(CGRect)aRect
}
}

#ifdef WY_BASE_SDK_8_ENABLED
minX = MAX(_popoverLayoutMargins.left, _inView.layoutMargins.left);
maxX = overlayWidth - MAX(_popoverLayoutMargins.right, _inView.layoutMargins.right);
minY = MAX(_popoverLayoutMargins.top, _inView.layoutMargins.top);
maxY = overlayHeight - MAX(_popoverLayoutMargins.bottom, _inView.layoutMargins.bottom) - keyboardHeight;
#else
minX = _popoverLayoutMargins.left;
maxX = overlayWidth - _popoverLayoutMargins.right;
minY = WYStatusBarHeight() + _popoverLayoutMargins.top;
maxY = overlayHeight - _popoverLayoutMargins.bottom - keyboardHeight;
#endif

CGSize result = CGSizeZero;

Expand Down