diff --git a/FPPopoverController.m b/FPPopoverController.m index e9943c4..7677cf8 100644 --- a/FPPopoverController.m +++ b/FPPopoverController.m @@ -18,7 +18,7 @@ @interface FPPopoverController() UIWindow *_window; UIView *_parentView; UIView *_fromView; - UIDeviceOrientation _deviceOrientation; + UIInterfaceOrientation _deviceOrientation; BOOL _shadowsHidden; CGColorRef _shadowColor; @@ -68,7 +68,7 @@ -(void)addObservers [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willPresentNewPopover:) name:@"FPNewPopoverPresented" object:nil]; - _deviceOrientation = [UIDevice currentDevice].orientation; + _deviceOrientation = [UIApplication sharedApplication].statusBarOrientation; } @@ -212,13 +212,11 @@ -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfac -(CGFloat)parentWidth { - return _parentView.bounds.size.width; - //return UIDeviceOrientationIsPortrait(_deviceOrientation) ? _parentView.frame.size.width : _parentView.frame.size.height; + return UIDeviceOrientationIsPortrait(_deviceOrientation) ? _parentView.frame.size.width : _parentView.frame.size.height; } -(CGFloat)parentHeight { - return _parentView.bounds.size.height; - //return UIDeviceOrientationIsPortrait(_deviceOrientation) ? _parentView.frame.size.height : _parentView.frame.size.width; + return UIDeviceOrientationIsPortrait(_deviceOrientation) ? _parentView.frame.size.height : _parentView.frame.size.width; } -(void)presentPopoverFromPoint:(CGPoint)fromPoint @@ -359,7 +357,7 @@ -(void)setOrigin:(CGPoint)origin -(void)deviceOrientationDidChange:(NSNotification*)notification { - _deviceOrientation = [UIDevice currentDevice].orientation; + _deviceOrientation = [UIApplication sharedApplication].statusBarOrientation; BOOL shouldResetView = NO;