I have a TutorialsViewController with software to view a PageViewController, like:
- (void)viewDidLoad { [super viewDidLoad];
And I add the TutorialsContentViewController to the PageViewController using delegate methods:
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController { NSUInteger index = ((TutorialsContentViewController*) viewController).pageIndex; if ((index == 0) || (index == NSNotFound)) { return nil; } index--; return [self viewControllerAtIndex:index]; } - (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController { NSUInteger index = ((TutorialsContentViewController*) viewController).pageIndex; if (index == NSNotFound) { return nil; } index++; if (index == [self.tutorialsArray count]) { return nil; } return [self viewControllerAtIndex:index]; } - (TutorialsContentViewController *)viewControllerAtIndex:(NSUInteger)index { if (([self.tutorialsArray count] == 0) || (index >= [self.tutorialsArray count])) { return nil; }
Now, when I run this in the simulator, I see that everything is working fine, so the next child view controller is above the status bar, and it moves down as it scrolls.
I tried self.automaticallyAdjustsScrollViewInsets = false in the parental control controller, but the child view is still reset. The child view controller has an ImageView, which has start, end, upper and lower limits set to 0 initially (this causes a shift).
When I center the image horizontally and vertically and give it a fixed height and width, it works fine. But I want the image to completely populate the child view controller.
How to solve this view bias problem? Please, help.
Thanks.
ios objective-c autolayout uipageviewcontroller
Kiran thapa
source share