ios – 使用UINavigationController在UIPageViewController中下载内容

ios – 使用UINavigationController在UIPageViewController中下载内容,第1张

概述更新2 我一直在使用4英寸设备在iOS模拟器中运行和测试我的应用程序.如果我使用3.5英寸设备运行,标签不会跳转.在我的.xib中,在Simulated Metrics下,我将它设置为Retina 4英寸全屏.知道为什么我只在4英寸设备上看到这个问题吗? 更新1 在IB中,如果我在模拟指标中选择“导航栏”,我的标签仍然会跳转.我可以在第一个屏幕上正确呈现标签的唯一方法是不将导航控制器设置为我的窗口 更新2

我一直在使用4英寸设备在iOS模拟器中运行和测试我的应用程序.如果我使用3.5英寸设备运行,标签不会跳转.在我的.xib中,在Simulated Metrics下,我将它设置为Retina 4英寸全屏.知道为什么我只在4英寸设备上看到这个问题吗?

更新1

在IB中,如果我在模拟指标中选择“导航栏”,我的标签仍然会跳转.我可以在第一个屏幕上正确呈现标签的唯一方法是不将导航控制器设置为我的窗口的根视图控制器.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

我的窗口的rootVIEwController被设置为一个UINavigationController,其rootVIEwController嵌入了一个UIPageVIEwController.

当我的应用加载时,会显示初始视图,其内容会向下推一点,大小与导航栏大致相同.当我滚动pageVIEwController时,内容会跳转到它在nib中的位置,而pageVIEwController加载的所有其他vIEwControllers都可以.

在我的appDelegate中:

@H_301_25@self.window.rootVIEwController = [[UINavigationController alloc] initWithRootVIEwController:[ContainerVIEwController new]];

在ContainerVIEwController中:

@H_301_25@- (voID)vIEwDIDLoad { [super vIEwDIDLoad]; self.pvc = [[UIPageVIEwController alloc] initWithTransitionStyle:UIPageVIEwControllerTransitionStyleScroll navigationorIEntation:UIPageVIEwControllerNavigationorIEntationHorizontal options:nil]; self.pvc.dataSource = self; self.pvc.delegate = self; DetailVIEwController *detail = [DetailVIEwController new]; [self.pvc setVIEwControllers:@[detail] direction:UIPageVIEwControllerNavigationDirectionForward animated:false completion:nil]; [self addChildVIEwController:self.pvc]; [self.vIEw addSubvIEw:self.pvc.vIEw]; [self.pvc dIDMovetoParentVIEwController:self];}解决方法 所以我在进一步开发后又添加了另一个答案,我终于想到了我发现了什么.好像在iOS7中,UIPageVIEwController似乎有自己的UIScrollVIEw.因此,您必须将automaticAdjustsScrollVIEwInsets设置为false.这是我的vIEwDIDLoad现在:

@H_301_25@- (voID)vIEwDIDLoad{ [super vIEwDIDLoad]; self.automaticallyAdjustsScrollVIEwInsets = false; DetailVIEwController *detail = [[DetailVIEwController alloc] init]; [self setVIEwControllers:@[detail] direction:UIPageVIEwControllerNavigationDirectionForward animated:false completion:nil];}

无需在vIEwWillLayoutSubvIEws中添加任何内容(作为我之前建议的答案之一).

总结

以上是内存溢出为你收集整理的ios – 使用UINavigationController在UIPageViewController中下载内容全部内容,希望文章能够帮你解决ios – 使用UINavigationController在UIPageViewController中下载内容所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1067447.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-26
下一篇2022-05-26

发表评论

登录后才能评论

评论列表(0条)

    保存