IOS 8 UIPageViewController Applying constraints after transitions

My application has a multi-level textbook style view that users browse to find out about the application. This is implemented as described in this lesson . Having implemented it for both iOS 7 and 8, I compare how they work and find problems with the latter - here I run Xcode 6 GM.

It seems that the UIPageViewController passes the views after the transition is complete. I tried the delegate methods to find out what was going on:

- (void)pageViewController:(UIPageViewController *)pageViewController willTransitionToViewControllers:(NSArray *)pendingViewControllers { NSLog(@"Frame size before: %@", NSStringFromCGRect([(UIViewController*)pendingViewControllers[0] view].frame)); } - (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed { NSLog(@"Frame size after: %@", NSStringFromCGRect([(UIViewController*)previousViewControllers[0] view].frame)); } 

And here is an example output:

 Frame size before: {{0, 0}, {600, 600}} Frame size after: {{0, 0}, {320, 568}} 

This manifests itself as follows: swipe the screen to the left to pull out the next view, and pay attention to the 32-pt-white space at the bottom of the new view. Once the transition is complete, it breaks into the correct layout.

Perhaps this is a bug in iOS 8? At the moment, I’m all guessing.

+64
autolayout ios8 xcode6 uipageviewcontroller
Sep 11 '14 at 15:14
source share
5 answers

I realized that you need to base your limitations on the view, not the layout of your controller. This will ensure that your view controller respects the restrictions you set before going to PageViewController.

you can do it like this:

Constraints example

Do not forget to uncheck the "Limit to fields"

+112
Oct 06 '14 at 12:24
source share

For everyone who has this problem, it turned out for me that I spread my views β€œrelative to the field” (a new feature in iOS 8).

Instead:

enter image description here

Using:

enter image description here

+40
Oct 10 '14 at 1:57
source share

I struggled with this for several days.

I tried to implement it by creating an instance of the ViewController page from the storyboard. A certain resizing has occurred. Check frame size in

  • pageViewController: viewControllerAfterViewController
  • pageViewController: willTransitionToViewControllers
  • pageViewController: didFinishAnimating: previousViewControllers

The frame size will always change between calls 1 and 3 . Sometimes before 2 , and sometimes after.

If you also use storyboards, I was able to solve the problem by extracting the user interface elements of the page into my own XIB file, setting restrictions to IB, and then creating pages with initWithNibName .

Not a complete answer, but he returned to me a sense of productivity. Hope this helps.

+2
Oct 07 '14 at 23:48
source share

For me, the solution was to display the top of the View table for viewing: Editor -> Pin -> Top Space To SuperView (iOS8)

+1
May 07 '15 at 10:22
source share

This is a bug in iOS 8, but I found a workaround:

Add a blank view over the status bar in your storyboard. The height of the view must be the same as the y-value of the object being moved.

Image of correct constraints

0
Sep 17 '14 at 13:11
source share



All Articles