gpt4 book ai didi

ios - 尝试理解 PageViewController

转载 作者:行者123 更新时间:2023-11-29 04:12:45 27 4
gpt4 key购买 nike

我通读了文档,但我仍然无法理解这个文档。我有一个导航 VC,我将 pageview VC 设置为它的根(尽管它没有达到 PageViewController 中 viewdidload 中的断点)。到目前为止,所有内容都在 Storyboard中完成。

我现在是否在 Storyboard中创建两个新的 View Controller 并用这两个 Controller 创建一个数组?他们从哪里获得此页面的 VC?

谢谢。

这是来自 pageviewcontroller 的一些代码:(什么也没有发生,只是黑屏)

@implementation ResultsViewController

- (void)viewDidLoad
{
[super viewDidLoad];
self.delegate=self;
self.dataSource=self;

NSMutableArray *array=[[NSMutableArray alloc]init];
[array addObject:[[Page1ViewController alloc]init]];
[array addObject:[[Page2ViewController alloc]init]];

[self setViewControllers:[NSArray arrayWithArray:array] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:nil];
// Do any additional setup after loading the view.
}
-(void)setViewControllers:(NSArray *)viewControllers direction:(UIPageViewControllerNavigationDirection)direction animated:(BOOL)animated completion:(void (^)(BOOL))completion{};

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

最佳答案

要了解 UIPageViewController 如何使用 Storyboard工作,您应该创建一个新项目,而不是选择单一 View 应用程序,只需选择基于页面的 View 应用程序,它将自动连接所有内容,从那里您可以进一步自定义.

关于ios - 尝试理解 PageViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14179922/

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