Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to empty an UIPageViewController (Remove ViewControllers inside)

After setting up a PageViewController I'd like to remove the view controllers inside, leaving it empty.

How can I do this?

I've tried the setViewControllers:direction:animated:completion: method passing nil or an empty array in the viewControllers param but it crashes.

How can I do this?

like image 361
Addev Avatar asked Dec 25 '22 06:12

Addev


1 Answers

If calling setViewControllers:direction:animated:completion: with nil for the viewControllers parameter crashes, try setting the view controllers to an array with a single empty view controller.

[pageViewController setViewControllers:@[UIViewController.new] direction:direction animated:true completion:nil];
like image 72
EmilioPelaez Avatar answered Dec 28 '22 09:12

EmilioPelaez