0

我通读了文档,但是我仍然无法理解这个文档。我有一个导航 VC,我将一个 pageview VC 设置为它的根(虽然它没有在 PageViewController 的 viewdidload 中命中我的断点)。到目前为止,一切都在故事板中完成。

我现在是否在情节提要中创建两个新的视图控制器并用这两个创建一个数组?他们从哪里获得此页面 VC 的 VC?

谢谢。

这是来自 pageviewcontroller 的一些代码:(没有任何反应,只是黑屏)

@实现结果视图控制器

- (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.
}
4

1 回答 1

1

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

于 2013-01-06T15:20:00.230 回答