Search code examples
ios7ios8autolayoutconstraintsecslidingviewcontroller

iOS 7 AutoLayout Constraints not working when superview resized (only on first resize)


Please go to the link below to see the problem in action

https://i.sstatic.net/NpQpg.jpg

You can see the constraint for the bottom view that should make the view's bottom align with the superview's bottom doesn't work. And for both the top and bottom views, you see that their "trailing space" constraint isn't working. But it's only for the first time the superview is resized, after the app is first open.

It works perfectly in iOS 8. I'm only having problems in iOS 7.

I'm using the ECSlidingViewController, along with the MEZoomAnimationController that's a delegate for it, in order to make the slide out menu work.


Solution

  • I finally found a solution to my problem. The "topViewAnchorRightEndState" function in the "MEZoomAnimationController" uses the following line for zooming out the "topViewController":

    topView.layer.transform = CATransform3DMakeScale(MEZoomAnimationScaleFactor, MEZoomAnimationScaleFactor, 1);
    

    I replaced that line of code with the following:

    topView.transform = CGAffineTransformMakeScale(MEZoomAnimationScaleFactor, MEZoomAnimationScaleFactor);
    

    Although I'm still somewhat curious about the root reason why CATransform3DMakeScale wasn't working.