I ran into a problem. I am working on an application and I am using a storyboard with Autolayout enabled. Now on one of my UIViewControllers I posted a UIView (say, A). Now A has several UIViews ( UIViews , to be precise). I applied the restriction “ Horizontally and Vertically centered ” to A. The mobility inside A does not have any restrictions on them.
Now in my code, I have a method for animating subviews inside A. Inside this method, I call UIView's animation method ...
[UIView animateWithDuration: delay: options: animations: completion:];
and animate one of the views inside View A. Now the problem is that these frame changes are not saved. When I modify the view controller on the current view controller and then turn it off, the frames of all subzones inside A get reset.
I looked for it and found out that the problem is due to Autolayout . I turned it off and then tried again and everything worked out well.
But what is the workaround with Autostart enabled ...?
Did I miss something...?
Interestingly, many posts on Stackoverflow have suggested that
we must animate restrictions and NOT frames when using autorun.
BUT I did not apply any restrictions to the subzones within View A. The restrictions apply only to view A.
Thanks.
ios iphone autolayout animation uiview
Assad Javed Karim
source share