Ios 如何从包含多个页面的UIPageViewController中删除一个页面

Ios 如何从包含多个页面的UIPageViewController中删除一个页面,ios,uipageviewcontroller,Ios,Uipageviewcontroller,我的应用程序中有一个UIPageViewController,用作不同UICollectionViewController的容器。每个UICollectionViewController都代表一个新闻源,用户可以在UIPageViewController中添加和删除该新闻源,并在不同的新闻源之间滑动。要添加新闻源,用户点击+按钮,从新加载的视图中选择主题,返回时,UIPageViewController加载所有视图并按预期显示。到现在为止,一直都还不错。我现在想要实现的是,当用户点击垃圾箱按钮时

我的应用程序中有一个UIPageViewController,用作不同UICollectionViewController的容器。每个UICollectionViewController都代表一个新闻源,用户可以在UIPageViewController中添加和删除该新闻源,并在不同的新闻源之间滑动。要添加新闻源,用户点击+按钮,从新加载的视图中选择主题,返回时,UIPageViewController加载所有视图并按预期显示。到现在为止,一直都还不错。我现在想要实现的是,当用户点击垃圾箱按钮时,当前可见视图将从UIPageViewController中删除,并且只有剩余视图保留在UIPageViewController中

对我来说,实现这一点的唯一方法是通过按下trash按钮,加载新视图,然后返回UIPageViewController,从ViewController数组中删除相应的ViewController

因此,基本问题是:在UIPageViewController视图中,如何从UIPageViewController中删除ViewController并重新加载UIPageViewController


非常感谢您的帮助。

如评论中所述,请参阅此


以正确的方式设置ViewController。

如注释中所述,请参见此


以正确的方式设置ViewController。

试试这个是的,实际上就是这样。我以前遇到过这个问题,但是使用了错误的代码。我没有给SetViewController一个ViewController,而是给它传递了一个多个ViewController的数组。修正后,它完全符合我的要求。谢谢Samkit。好的。请投票支持我的答案。我写了一封信。是的,事实上就是这样。我以前遇到过这个问题,但是使用了错误的代码。我没有给SetViewController一个ViewController,而是给它传递了一个多个ViewController的数组。修正后,它完全符合我的要求。谢谢Samkit。好的。请投票支持我的答案,我正在写一个