gpt4 book ai didi

ios - 页面 View Controller 数据源

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:12:05 25 4
gpt4 key购买 nike

<分区>

我是 Obj-C 的新手,正在学习它的阶段。刚刚看到该代码并试图获得它。但是,在以 -(UIViewController *) pageViewController.... 开头的第一个代码中,对我来说太复杂了。

谁能一步一步解释一下?

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController
{
NSUInteger index = ((PageContentViewController*) viewController).pageIndex;

if ((index == 0) || (index == NSNotFound)) {
return nil;
}

index--;
return [self viewControllerAtIndex:index];
}

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController
{
NSUInteger index = ((PageContentViewController*) viewController).pageIndex;

if (index == NSNotFound) {
return nil;
}

index++;
if (index == [self.pageTitles count]) {
return nil;
}
return [self viewControllerAtIndex:index];
}

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