Skip to content

Commit

Permalink
Merge pull request #62 from codingrogue/develop
Browse files Browse the repository at this point in the history
PR: Support modally presented controllers
  • Loading branch information
sammcewan committed Jun 20, 2015
2 parents 0b3fad3 + 69abbc8 commit 63a2b81
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions WYPopoverController/WYPopoverController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,7 @@ - (void)presentPopoverFromRect:(CGRect)aRect
options = aOptions;

if (!_inView) {
_inView = [UIApplication sharedApplication].keyWindow.rootViewController.view;
_inView = [UIApplication sharedApplication].keyWindow;
if (CGRectIsEmpty(_rect)) {
_rect = CGRectMake((int)_inView.bounds.size.width / 2 - 5, (int)_inView.bounds.size.height / 2 - 5, 10, 10);
}
Expand All @@ -1784,7 +1784,7 @@ - (void)presentPopoverFromRect:(CGRect)aRect
CGSize contentViewSize = self.popoverContentSize;

if (_overlayView == nil) {
_overlayView = [[WYPopoverOverlayView alloc] initWithFrame:_inView.window.bounds];
_overlayView = [[WYPopoverOverlayView alloc] initWithFrame:_inView.bounds];
_overlayView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_overlayView.autoresizesSubviews = NO;
_overlayView.delegate = self;
Expand All @@ -1806,8 +1806,8 @@ - (void)presentPopoverFromRect:(CGRect)aRect
[_backgroundView addGestureRecognizer:tap];
}

[_inView.window addSubview:_backgroundView];
[_inView.window insertSubview:_overlayView belowSubview:_backgroundView];
[_inView addSubview:_backgroundView];
[_inView insertSubview:_overlayView belowSubview:_backgroundView];
}

[self updateThemeUI];
Expand Down Expand Up @@ -1840,8 +1840,8 @@ - (void)presentPopoverFromRect:(CGRect)aRect

void (^adjustTintDimmed)() = ^() {
#ifdef WY_BASE_SDK_7_ENABLED
if (_backgroundView.dimsBackgroundViewsTintColor && [_inView.window respondsToSelector:@selector(setTintAdjustmentMode:)]) {
for (UIView *subview in _inView.window.subviews) {
if (_backgroundView.dimsBackgroundViewsTintColor && [_inView respondsToSelector:@selector(setTintAdjustmentMode:)]) {
for (UIView *subview in _inView.subviews) {
if (subview != _backgroundView) {
[subview setTintAdjustmentMode:UIViewTintAdjustmentModeDimmed];
}
Expand Down Expand Up @@ -2085,7 +2085,7 @@ - (void)positionPopover:(BOOL)aAnimated {

WYPopoverArrowDirection arrowDirection = _permittedArrowDirections;

_overlayView.bounds = _inView.window.bounds;
_overlayView.bounds = _inView.bounds;
_backgroundView.transform = CGAffineTransformIdentity;

viewFrame = [_inView convertRect:_rect toView:nil];
Expand Down Expand Up @@ -2400,8 +2400,8 @@ - (void)dismissPopoverAnimated:(BOOL)aAnimated

void (^adjustTintAutomatic)() = ^() {
#ifdef WY_BASE_SDK_7_ENABLED
if ([_inView.window respondsToSelector:@selector(setTintAdjustmentMode:)]) {
for (UIView *subview in _inView.window.subviews) {
if ([_inView respondsToSelector:@selector(setTintAdjustmentMode:)]) {
for (UIView *subview in _inView.subviews) {
if (subview != _backgroundView) {
[subview setTintAdjustmentMode:UIViewTintAdjustmentModeAutomatic];
}
Expand Down

0 comments on commit 63a2b81

Please sign in to comment.