1

I have 2 pages in my app that are transitioned with a UIPageViewController. The first page loads fine but the second page will have a 'dropping' motion similar to the .gif image below. enter image description here

This will only occur once when the page is loaded. I am not really sure what causes this but my suspicions could be the constraints. It seems to be applying the constraints when the page is loaded.

I am currently looking at a solution to pre-load the pages first and if this works, i will expand the solution to pre-load only the previous and next page (if any). If there are any better solutions out there, do share with me.

winhung
  • 553
  • 1
  • 5
  • 19
  • I have found some other possible solutions to this problem. It seems like the constraints of that view were applied AFTER the page appeared. Hence, here are some possible solutions that i will try and you folks can take a look. 1) http://stackoverflow.com/questions/25791183/ios-8-uipageviewcontroller-applying-constraints-after-transitions/26290775#26290775 2) http://stackoverflow.com/questions/25925058/ios-8-xcode-6-autolayout-constraints-applied-after-view-appears – winhung Mar 17 '15 at 07:37

3 Answers3

1

I've had similar issues caused by the navigation controller/navigation bar and the automaticallyAdjustsScrollViewInsets property in code, or the "Adjust Scroll View Insets" property in the storyboard. It looks like your first page does not have it set, and the second page does.

Oliver
  • 566
  • 4
  • 10
  • Hi Oliver, tried that before, it does not affect anything. However, on another note, i had another problem with my webview giving a white space between the navi bar and the webview it self. Setting automaticallyAdjustsScrollViewInsets resolved the white space issue. – winhung Mar 17 '15 at 07:35
  • I had the same problem, and this solution solved the problem for me. I just removed the tick on "Adjust scroll view insets" on the Page View Controller, and all was OK after that. – Eric May 21 '17 at 18:22
0

I solved the problem by looking at 2 questions that was previously asked in stackoverflow.

The key point to take away was that when setting constraints you had to use the value with respect from the current View. Darryl Bayliss's answer here has a screenshot that gives a better understanding.

To understand more of this, looking at wuc's question and answers will provide some clue too.

For my problem, Darryl Bayliss's solution worked for me.

Community
  • 1
  • 1
winhung
  • 553
  • 1
  • 5
  • 19
0

I fixed this issue (for Swift, iOS 8.3 ) ,; it is not big things , When you add constraints via "Add New Constraints" ,choose Constraint to margin, (add your constraints without margins).

sameera
  • 1
  • 2