Skip to content
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
56 changes: 35 additions & 21 deletions FPPopoverController.m
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ - (void)viewDidLoad

#pragma mark Orientation

-(BOOL)shouldAutorotate {
if ([_viewController respondsToSelector:@selector(shouldAutorotate)])
return [_viewController shouldAutorotate];
return YES;
}

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
if ([_viewController respondsToSelector:@selector(shouldAutorotateToInterfaceOrientation:)])
Expand Down Expand Up @@ -304,34 +310,42 @@ -(void)deviceOrientationDidChange:(NSNotification*)notification
_deviceOrientation = [UIDevice currentDevice].orientation;

BOOL shouldResetView = NO;
UIInterfaceOrientation interfaceOrientation;
switch (_deviceOrientation)
{
case UIDeviceOrientationLandscapeLeft:
interfaceOrientation = UIInterfaceOrientationLandscapeLeft;
break;
case UIDeviceOrientationLandscapeRight:
interfaceOrientation = UIInterfaceOrientationLandscapeRight;
break;
case UIDeviceOrientationPortrait:
interfaceOrientation = UIInterfaceOrientationPortrait;
break;
case UIDeviceOrientationPortraitUpsideDown:
interfaceOrientation = UIInterfaceOrientationPortraitUpsideDown;
break;
default:
return; // just ignore face up / face down, etc.
}
if (_viewController.interfaceOrientation == interfaceOrientation)
return;

//iOS6 has a new orientation implementation.
//we ask to reset the view if is >= 6.0
if ([_viewController respondsToSelector:@selector(shouldAutorotateToInterfaceOrientation:)] &&
[[[UIDevice currentDevice] systemVersion] floatValue] < 6.0)
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 6.0)
{
UIInterfaceOrientation interfaceOrientation;
switch (_deviceOrientation)
if ([_viewController
respondsToSelector:@selector(shouldAutorotateToInterfaceOrientation:)])
{
case UIDeviceOrientationLandscapeLeft:
interfaceOrientation = UIInterfaceOrientationLandscapeLeft;
break;
case UIDeviceOrientationLandscapeRight:
interfaceOrientation = UIInterfaceOrientationLandscapeRight;
break;
case UIDeviceOrientationPortrait:
interfaceOrientation = UIInterfaceOrientationPortrait;
break;
case UIDeviceOrientationPortraitUpsideDown:
interfaceOrientation = UIInterfaceOrientationPortraitUpsideDown;
break;
default:
return; // just ignore face up / face down, etc.
shouldResetView
= [_viewController shouldAutorotateToInterfaceOrientation:interfaceOrientation];
}
}
else
#endif
{
shouldResetView = YES;
if ([_viewController respondsToSelector:@selector(shouldAutorotate)])
shouldResetView = [_viewController shouldAutorotate];
}

if (shouldResetView)
Expand Down