gpt4 book ai didi

ios - View 无法正确显示 Storyboard

转载 作者:搜寻专家 更新时间:2023-11-01 05:43:18 25 4
gpt4 key购买 nike

我创建了一个基于页面的应用程序,它已经有多个 View 。 RootViewController 负责设置应用程序布局,除了一件事,它做得很好, View 大小。

这是我的一部分

    // Configure the page view controller and add it as a child view controller
self.pageViewController = UIPageViewController(
transitionStyle: .Scroll,
navigationOrientation: .Horizontal,
options: nil
);

self.pageViewController.delegate = self;

// Setup the initial page
let startingViewController = self.modelController.viewControllerWithProfileProvider(
self.profileProviderPreference(),
storyboard: self.storyboard
);

self.pageViewController.setViewControllers(
[startingViewController as BrowsingViewControllerBase] as [AnyObject],
direction: UIPageViewControllerNavigationDirection.Forward,
animated: false,
completion: { done in }
);

self.pageViewController.dataSource = self.modelController;
self.addChildViewController(self.pageViewController);
self.view.addSubview(pageViewController.view);

// Set the page view controller's bounds using an inset rect so that self's view is visible around the edges of the pages
self.pageViewController.view.frame = self.view.bounds;

// Notify the page view controller that we just moved to it. This is a framework imposition. See the docs.
self.pageViewController.didMoveToParentViewController(self);

// Add the page view controller's gesture recognizers to the view controller's view so that the gestures are started more easily.
self.view.gestureRecognizers = self.pageViewController.gestureRecognizers;

Controller 中的所有其他代码处理行为,而不是方面,所以我使用 Storyboard 设置其他所有内容。 viewControllerWithProfileProvider: 方法返回正确的 View ,该 View 显示在屏幕上,但不正确。这是我在 Storyboard 中的内容:

enter image description here

然后我根据给定的提供商(即 Facebook、Twitter、LinkedIn...)更改按钮的颜色和标签。但我明白了:

enter image description here

注意按钮是如何离开屏幕的。我假设 self.pageViewController.view.frame = self.view.bounds; 是关键行,但我不确定该使用什么。如何才能正确显示我的 View ?

最佳答案

Control 单击该框并向上拖动,然后从弹出窗口中选择 Top space to top layout。在左右两侧做同样的事情,分别选择前导空格和尾随空格。运行您的应用程序,希望这对您有所帮助

关于ios - View 无法正确显示 Storyboard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24668628/

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