uipageviewcontroller类在设置多个视图控制器时崩溃
我的应用程序不断崩溃,当我在我的应用程序中设置多个视图控制器,如下所示。
[self setViewControllers:_images direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:NULL];
我的图像是一个视图控制器的数组。
该应用程序崩溃说以下错误。 我不知道从哪里开始。
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'The number of view controllers provided (9) doesn't match the number required (1) for the requested transition
正如错误所述,您提供了比所需更多的视图控制器。 您应该只在数组中提供1个视图控制器。 然后使用页面视图控制器的dataSource方法正确地提供视图控制器之前和之后。
UIPageViewController在iOS中有一些错误。 改用UIViewController的UIScrollView + NSArray! 也许这会有所帮助。 http://weijun.me/post/develop/2015-11-26