Ganesh G
Ganesh G

Reputation: 2061

Orientation broken in iOS 9

I have developed an iOS app which support Orientation as well. Till iOS 8.4 it was giving me correct view size (width and Height) in viewWillAppear method according to Orientation changes. But now I ran my existing app in Xcode 7 with iOS 9 then Orientation has broken as the view size is not correct if you display it in viewWillAppear method. I am updating all controllers of frame through viewWillAppear method, but now its not working. Is there any other solution to achieve it. I am using Xib without Autolayout enabled. Please help me.

Upvotes: 1

Views: 350

Answers (1)

gils
gils

Reputation: 61

Something very similar happened to me and I stumbled upon this question when googling for an answer. The issue in my case was because of a custom UIViewControllerAnimatedTransitioning implementation which failed to assign the proper frame for the new view.

- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext {
    UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
    UIView *toView = toVC.view;
    toView.frame = [transitionContext finalFrameForViewController:toVC];
    // transition animation goes here...
}

I don't know why, but until iOS 9 there wasn't an issue if this line was missing.

Hope it help

Upvotes: 1

Related Questions