快速滚动时,UIPageViewController崩溃

时间:2018-08-27 15:06:47

标签: performance scroll

我用以下代码创建了自己的UIPageViewController:

- (void)setupPageViewController {  
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll  
                                                          navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal  
                                                                        options:nil];  
    self.pageViewController.delegate = self;  
    self.pageViewController.dataSource = self;  
    [self addChildViewController:self.pageViewController];  
}  

然后我调用以下代码:

if (targetPage > self.currentPage) {  
        [self.pageViewController setViewControllers:@[controller]  
                                          direction:UIPageViewControllerNavigationDirectionForward  
                                           animated:YES  
                                         completion:nil];  
} else {  
    [self.pageViewController setViewControllers:@[controller]  
                                          direction:UIPageViewControllerNavigationDirectionReverse  
                                           animated:YES  
                                         completion:nil];  
}  

当我快速调用此代码时,应用程序崩溃并记录以下内容:

*** Assertion failure in -[UIPageViewController _flushViewController:animated:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3698.54.4/UIPageViewController.m:2137  

我找到了有关此崩溃的一些解决方案:

Assertion failure in UIPageViewController

Assertion failure in UIPageViewController

实际上这是行不通的。

0 个答案:

没有答案