作者热门文章
- objective-c - iOS 5 : Can you override UIAppearance customisations in specific classes?
- iphone - 如何将 CGFontRef 转换为 UIFont?
- ios - 以编程方式关闭标记的信息窗口 google maps iOS
- ios - Xcode 5 - 尝试验证存档时出现 "No application records were found"
所以,我有一个从 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/
我是一名优秀的程序员,十分优秀!