大佬教程收集整理的这篇文章主要介绍了iphone – 如何在UIPageViewController中设置第一页,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
*** TerminaTing app due to uncaught exception 'NSInvalidArgumentexception',reason: 'the number of view controllers provided (0) doesn't match the number required (1) for the requested transition'
这是我的代码.返回contentViewController而不是nil时,它工作正常.我该怎么办而不是零?
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController { contentViewController = [[ContentViewController_iPhone alloc] init]; int currenTindex = [self.modelArray indexOfObject:[(ContentViewController_iPhone *)viewController labelContents]]; if ((currenTindex == 0) || (currenTindex == NsnotFound)) { //if on the first page,can't go BACk return nil; } contentViewController.labelContents = [self.modelArray objectATindex:currenTindex - 1]; return contentViewController; }
对我来说,它不适用于iOS 6的重新分配.这很好,因为iOS处理的触摸有点不同.页面上的按钮或您自己的手势识别器在iOS 6下可以正常工作,因为它们具有优先级并会自动取消分页.
我希望这有帮助.
以上是大佬教程为你收集整理的iphone – 如何在UIPageViewController中设置第一页全部内容,希望文章能够帮你解决iphone – 如何在UIPageViewController中设置第一页所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。