I am trying to use UIPageViewController with view controllers added to it, problem is if I launch the app in portrait mode it appears perfectly like this:
http://i.stack.imgur.com/ryT5d.png but if I rotate the device to landscape mode it appears like this: http://i.stack.imgur.com/GnuYH.png Though pagination control has resized properly, view of added view controller has not resized properly. Below is the code which I have used to add respective view controller as root view controller in AppDelegate: pagesContainerViewController = [[RWPagesContainerViewController alloc] initWithNibName:@"RWPagesContainerViewController" bundle:nil]; [pagesContainerViewController loadPaginationControlAtIndex:0]; self.window.rootViewController = pagesContainerViewController; Here is the implementation of loadPaginationControlAtIndex method: - (void)loadPaginationControlAtIndex:(RWPaginationView)viewIndex { _pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; FirstViewController *firstViewController = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil]; SecondViewController *secondViewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; ThirdViewController *thirdViewController = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil]; _subviewControllers = @[firstViewController, secondViewController, thirdViewController]; [self.pageController setViewControllers:@[_subviewControllers[viewIndex]] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:nil]; [self addChildViewController:self.pageController]; [[self view] addSubview:[self.pageController view]]; UIView *insertedView = self.pageController.view; insertedView.translatesAutoresizingMaskIntoConstraints = NO; self.view.translatesAutoresizingMaskIntoConstraints = NO; [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[insertedView]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(insertedView)]]; [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[insertedView]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(insertedView)]]; [self.view layoutIfNeeded]; self.pageController.dataSource = self; } Am I missing anything? Please suggest. -- Thanks, Devarshi _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
