【发布时间】:2013-08-14 16:17:10
【问题描述】:
更新 2
我一直在使用 4 英寸设备在 iOS 模拟器中运行和测试我的应用程序。如果我使用 3.5 英寸设备运行,标签不会跳动。在我的 .xib 中,在 Simulated Metrics 下,我将其设置为 Retina 4 英寸全屏。知道为什么我只在 4 英寸设备上看到这个问题吗?
更新 1
在 IB 中,如果我在 Simulated Metrics 中选择“导航栏”,我的标签仍然会跳动。我可以让我的标签在第一个屏幕上正确呈现的唯一方法是不将导航控制器设置为我的窗口的根视图控制器。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
我的窗口的 rootViewController 被设置为一个 UINavigationController,它的 rootViewController 嵌入了一个 UIPageViewController。
当我的应用加载时,初始视图的内容会被向下推一点,与导航栏的大小大致相同。当我滚动 pageViewController 时,内容会跳转到它放置在 nib 中的位置,并且 pageViewController 加载的所有其他 viewController 都很好。
在我的 appDelegate 中:
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[ContainerViewController new]];
在 ContainerViewController 中:
- (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];
}
【问题讨论】:
-
在“属性检查器”选项卡中设计界面(.xib 文件)时,从下拉菜单中选择顶部栏作为“导航栏”,然后相应地放置标签,标签将保持原样原来的地方。
-
这实际上是我已经在做的。
标签: ios objective-c xcode uinavigationcontroller uipageviewcontroller