xcode – pageViewController setViewControllers崩溃与“无效参数不满意:[views count] == 3”

xcode – pageViewController setViewControllers崩溃与“无效参数不满意:[views count] == 3”,第1张

概述我知道这里还有其他几个问题,但是我找不到解决问题的办法。 我使用一个pageViewController来显示不同的ViewController。每次pageViewController向前移动时,我检查lastPage的输入。如果这是错误的,pageViewController应该通过使用setViewController方法返回到该页面。没有这种方法一切都可以正常工作,但如果我尝试使用它,应用 我知道这里还有其他几个问题,但是我找不到解决问题的办法。
我使用一个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        }    }}

正如我已经说过的我搜索了很多,并实施了一些解决方案,但没有任何帮助。
谢谢。

解决方法 我遇到同样的问题,并能够使用这个答案 http://stackoverflow.com/a/20973822/3757370的提示来解决它。只需放置setVIEwController:direction:animated:completion:主队列中的dispatch_async块中的代码为我修复它。对你来说,这样会像

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”所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1073124.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存