gpt4 book ai didi

ios - 如何在没有手势的情况下自动触发翻页转换?

转载 作者:行者123 更新时间:2023-11-28 19:59:40 25 4
gpt4 key购买 nike

我使用带有 PageControl 的 UIPageViewController 在我的 PageViewController 中显示图像。一切都很完美。但是页面是否有可能在特定时间后自动滑动(滚动)到下一页?

你有这段代码但不起作用,我需要 UIPageViewController 自动滚动。

NSTimer *aTimer;
NSArray *viewControllers;


-(void)viewDidAppear:(BOOL)animated{

aTimer = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(animacion) userInfo:nil repeats:YES];

}


-(void)animation{

[pageVCObj setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:nil];
}



- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.


self.pageController.doubleSided =YES;

self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];

self.pageController.dataSource = self;
[[self.pageController view] setFrame:[[self view] bounds]];

APPChildViewController5 *initialViewController = [self viewControllerAtIndex:0];

viewControllers = [NSArray arrayWithObject:initialViewController];

[self.pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];

[self addChildViewController:self.pageController];
[[self view] addSubview:[self.pageController view]];
[self.pageController didMoveToParentViewController:self];


}

最佳答案

你有一个错字:

aTimer = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(animacion) userInfo:nil repeats:YES];

您提供选择器名称 animacion 但您的方法称为 animation

关于ios - 如何在没有手势的情况下自动触发翻页转换?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24829604/

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