Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing count to zero doesn't remove last View Controller #229

Open
magora-obukhov opened this issue Sep 19, 2019 · 1 comment
Open

Changing count to zero doesn't remove last View Controller #229

magora-obukhov opened this issue Sep 19, 2019 · 1 comment

Comments

@magora-obukhov
Copy link

magora-obukhov commented Sep 19, 2019

Doing reloadData() if numberOfViewControllers(in pageboyViewController returns zero after having some view controllers on the screen they still present. So I can't clear view controllers.

The reason is this code in PageboyViewController+Management.swift:

 guard defaultIndex < newViewControllerCount,
     let viewController = fetchViewController(at: defaultIndex) else {
         return
 }
@AlTavares
Copy link

I'm having a similar issue, as a workaround I'm using a UIViewController with Pageboy as a child, and when I need to reset I setup a new Pageboy

       // remove old pageboy
        pageViewController.removeFromParent()
        pageViewController.view.removeFromSuperview()

       // create and setup the new one
        pageViewController = PageboyViewController()
        addChild(pageViewController)
        pageViewController.didMove(toParent: self)
        view.addSubview(pageViewController.view)
        pageViewController.delegate = self

I hope this helps :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants