2
votes

I have a strange animation when I pop a ViewController on my NavigationController. Short video to illustrate: https://youtu.be/IMbIS7evLrs

The view controller structure is: UITabBarController -> UINavigationControllers -> UIViewControllers

I push the new VC using this line in my UIViewController:

    [self.navigationController pushViewController:tripVC animated:YES];

Where tripVC is a newly created UIViewController. Then the pop happens when the NavigationController Back button is clicked. I've also tried calling the pop programmatically using

[self.navigationController popViewControllerAnimated:YES];

from within tripVC and get the same strange animation.

What's particularly odd is I've used this structure / approach on other apps and haven't had this problem. Am wondering if there's some strange segue code in my app / am missing some animation code?

3
It seems that the background image in the second VC is wider than the device screen. Check the constraints. It could also be to do with the content mode of the UIImageView - to maintain the aspect ratio, the imageview may be exceeding the width of the screenPaulw11
@Paulw11 - that could well be it! It is wider - deliberately - as I use UIMotionEffectGroup on another view and want the image to be the same on this VC. Will take a look.CharlesA
@Paulw11 - wow - that was it. Been struggling with that one for some time. Thanks. Please post as an answer and I'll accept.CharlesA

3 Answers

8
votes

It seems that the background image in the second VC is wider than the device screen. As this scene pushes in/out the normally hidden edge of the image is revealed briefly.

2
votes

Yes, for my case @Paulw11 is right. Enable clipsToBound to your root view.

0
votes

If you haven't given background color of self.view then also it may occur. This is the second reason for strange animation for navigation.