
*** 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;}解决方法 我遇到了同样的问题并发现只有当我将pagevIEwcontrollers gestureRecognizers的代理更改为我自己的控制器时才会发生这种情况(如果你想在用户点击页面上的某些区域时取消分页,这通常会发生,例如按钮). 对我来说,它不适用于iOS 6的重新分配.这很好,因为iOS处理的触摸有点不同.页面上的按钮或您自己的手势识别器在iOS 6下可以正常工作,因为它们具有优先级并会自动取消分页.
我希望这有帮助.
总结以上是内存溢出为你收集整理的iphone – 如何在UIPageViewController中设置第一页全部内容,希望文章能够帮你解决iphone – 如何在UIPageViewController中设置第一页所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)