Storyboard/UIPageViewController resets subviews' positions
Do you have a SinglePageViewController in a UIPageViewController and programmatically adjust positions of subviews defined in your Storyboard? Then you'll probably see jumping subviews on your pages whenever you start to swipe from one page to another. Why? Because UIPageViewController will layout the subviews of the SinglePageViewControllers whenever a swipe starts.
You have 2 options:
1) Turn off "Use Auto Layout" in your StoryBoard's file inspector panel.
2) Adjust the subviews' positions programmatically in viewDidLayoutSubviews.
// SinglePageViewController.m
...
-(void)viewDidLayoutSubviews {
// Adjust the subviews' positions
}
There you go. No more jumping subviews. :)
Written by Robert Wünsch
Related protips
2 Responses
does any other way to solve this problem?
over 1 year ago
·
I guess, instead you could leave Auto Layout turned on, define proper Layout Constraints, assign them to IBOutlets in your view/controller and adjust them programmatically whenever needed. I didn't know how to do that half a year ago.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#