I have been working an iOS 7 app to make it compatible for ios 8 (beta 5). In this application, UIViewController
(vc1
) presents another UIViewController
(vc2
). vc1
supports both Portrait and Landscape orientations; vc2
supports only Portrait orientation. When vc2
is presented, it asks vc1
: shouldAutorotateToInterfaceOrientation:
and this returns YES
.
In iOS8 (Beta 5) willRotateToInterfaceOrientation:
and didRotateFromInterfaceOrientation:
are not getting called as well as the new iOS 8 API method viewWillTransitionToSize
. But, this works fine in iOS7.
I know willAnimateRotationToInterfaceOrientation
and didRotateFromInterfaceOrientation
are deprecated in iOS 8, but even iOS 8 delegate methods are not getting called. Every time when launched vc2
from vc1
always screens loads in portrait mode only even though I mentioned supported interface orientation as landscape left.
Any ideas... is it a bug in iOS8?
Well, I didn't figure out your problem best but as soon I have a bunch of lines working fine with rotation in iOS 8.1 I will present them to you. They are just taken and a little bit of edited from the Apple API Reference.
Simply I put this in every VC and i just edit the code when needed. For example I have an app that have initial view controller in portrait and then VC changes ( segue is done ) to a LandscapeVC with different features. This is the portrait view methods leading to a rotation in LandscapeView.
bool isShowingLandscapeView = false;
- (void)awakeFromNib
{
isShowingLandscapeView = NO;
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(orientationChanged:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
}
- (void)orientationChanged:(NSNotification *)notification
{
UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
if (UIDeviceOrientationIsLandscape(deviceOrientation) &&
!isShowingLandscapeView)
{
isShowingLandscapeView = YES;
[self performSegueWithIdentifier:@"toLandscape" sender:self];
}
I hope I made it simple for understanding. Don't hesitate to improve my answer, we all learn in this life !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With