So, I have a segue from UICollecionView item tapped to UIPageViewController. When PageViewController shows, the navigation bar makes dark gray, and UIView in it has a strange offset. However, after i click once in any place on screen, I see a strange "animation" and UIView moves up into its correct place. So, all views on screen get moved.
Here is the link for 5-second video with this bug: http://www.youtube.com/watch?v=CNbwBGvSzIk
PageViewController.m:
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = [[[EVAEvent events] objectAtIndex:self.currentIndex] name];
self.dataSource = self;
self.delegate = self;
UIViewController *vc = [self viewControllerAtIndex:self.currentIndex];
NSArray *controllers = [NSArray arrayWithObjects:vc, nil];
[self setViewControllers:controllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
}
- (UIViewController *)viewControllerAtIndex:(NSUInteger)index;
{
// NSLog(@"View Controller At Index = %lu", (unsigned long)self.currentIndex);
EVAEventInfoViewController *controller = [EVAEventInfoViewController getFromStoryboard];
EVAEvent *event = [[EVAEvent events] objectAtIndex:index];
[controller setIndex:index];
[controller setEvent:event];
return controller;
}
EVAEventInfoViewController.m:
+ (EVAEventInfoViewController *) getFromStoryboard
{
//NSLog(@"Creating EVAEventInfoViewController");
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
EVAEventInfoViewController *this = (EVAEventInfoViewController *)[sb instantiateViewControllerWithIdentifier:@"eventInfoController"];
return this;
}
Thanks a lot!
try adding
self.automaticallyAdjustsScrollViewInsets=NO;
in PageViewController's viewDidLoad
I set UIPageViewController and sub view controller with
self.automaticallyAdjustsScrollViewInsets=NO;
but it does not work if UITabBarController as root.
I captured the view hierarchy as the following
You can see the UIPageViewControllerContentView are correct position (0,0). But UIView under _UIQueuingScrollView generated the offset of status bar.
So, I decided not to use UIPageViewController. I use self.view addSubView to fixed this issue.
- (void)loadVC:(UIViewController*)vc
{
[self addChildViewController:vc];
vc.view.frame = self.view.bounds;
[self.view addSubview:vc.view];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With