Я пытаюсь использовать UIPageViewController с контроллерами отображения добавленных к нему, проблема, если я запустить приложение в портретном режиме он появляется совершенно так:UIPageViewController не изменение размера его вид ребенка контроллеры на вращение
но если повернуть устройство в ландшафтном режиме он будет выглядеть так:
Хотя управление нумерацией страниц был изменен должным образом, вид добавленного зрения Contro ller не изменился правильно.
Ниже приведен код, который я использовал, чтобы добавить соответствующий контроллер представления, как вид корневой контроллер в AppDelegate:
pagesContainerViewController = [[RWPagesContainerViewController alloc] initWithNibName:@"RWPagesContainerViewController" bundle:nil];
[pagesContainerViewController loadPaginationControlAtIndex:0];
self.window.rootViewController = pagesContainerViewController;
Вот реализация метода loadPaginationControlAtIndex:
- (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;
}
Я пропускаю что-нибудь ? Пожалуйста, предложите.