![xcode – pageViewController setViewControllers崩溃与“无效参数不满意:[views count] == 3”,第1张 xcode – pageViewController setViewControllers崩溃与“无效参数不满意:[views count] == 3”,第1张](/aiimages/xcode+%E2%80%93+pageViewController+setViewControllers%E5%B4%A9%E6%BA%83%E4%B8%8E%E2%80%9C%E6%97%A0%E6%95%88%E5%8F%82%E6%95%B0%E4%B8%8D%E6%BB%A1%E6%84%8F%EF%BC%9A%5Bviews+count%5D+%3D%3D+3%E2%80%9D.png)
我使用一个pageVIEwController来显示不同的VIEwController。每次pageVIEwController向前移动时,我检查lastPage的输入。如果这是错误的,pageVIEwController应该通过使用setVIEwController方法返回到该页面。没有这种方法一切都可以正常工作,但如果我尝试使用它,应用程序崩溃与以下异常:
19:48:25.596 Phook[23579:60b] *** Assertion failure in -[_UIQueuingScrollVIEw _replaceVIEws:updatingContents:adjustContentInsets:animated:],/SourceCache/UIKit_Sim/UIKit-2935.137/_UIQueuingScrollVIEw.m:383 2014-06-02 19:48:25.600 Phook[23579:60b] *** Terminating app due to uncaught exception 'NSInternalinconsistencyException',reason: 'InvalID parameter not satisfying: [vIEws count] == 3'
这是我的代码:
- (voID)pageVIEwController:(UIPageVIEwController *)pageVIEwController dIDFinishAnimating:(BOol)finished prevIoUsVIEwControllers:(NSArray *)prevIoUsVIEwControllers TransitionCompleted:(BOol)completed{ if (completed && finished) { RegisterUserPageContent* lastPage = (RegisterUserPageContent*)prevIoUsVIEwControllers[ prevIoUsVIEwControllers.count-1]; int lastIndex = lastPage.pageIndex; int newIndex = ((RegisterUserPageContent*)[self.pageVIEwController.vIEwControllers objectAtIndex:0]).pageIndex; if (newIndex > lastIndex) { // Moved Forward if(!lastPage.testinput) { [self.pageVIEwController setVIEwControllers:@[ [self.storyboard instantiateVIEwControllerWithIDentifIEr:_pageStoryBoardIDs[0]] ] direction:UIPageVIEwControllerNavigationDirectionReverse animated:YES completion:nil]; } } else { // Moved Reverse } }} 正如我已经说过的我搜索了很多,并实施了一些解决方案,但没有任何帮助。
谢谢。
dispatch_async(dispatch_get_main_queue(),^{ [self.pageVIEwController setVIEwControllers:@[ [self.storyboard instantiateVIEwControllerWithIDentifIEr:_pageStoryBoardIDs[0]] ] direction:UIPageVIEwControllerNavigationDirectionReverse animated:YES completion:nil];}); 希望有帮助!
总结以上是内存溢出为你收集整理的xcode – pageViewController setViewControllers崩溃与“无效参数不满意:[views count] == 3”全部内容,希望文章能够帮你解决xcode – pageViewController setViewControllers崩溃与“无效参数不满意:[views count] == 3”所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)