gpt4 book ai didi

ios - UIPageViewController subview 在屏幕点击后移到状态栏后面

转载 作者:技术小花猫 更新时间:2023-10-29 10:57:24 26 4
gpt4 key购买 nike

所以,我有一个从 UICollecionView 项目点击到 UIPageViewController 的 segue。 PageViewController 显示时,导航栏变成深灰色,其中的 UIView 有一个奇怪的偏移。但是,在我在屏幕上的任意位置单击一次后,我看到一个奇怪的“动画”并且 UIView 向上移动到正确的位置。因此,屏幕上的所有 View 都会移动。

这是带有此错误的 5 秒视频的链接: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;
}

非常感谢!

最佳答案

尝试添加

self.automaticallyAdjustsScrollViewInsets=NO;

在 PageViewController 的 viewDidLoad 中

关于ios - UIPageViewController subview 在屏幕点击后移到状态栏后面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20683000/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com