带有自定义MoreNavigationController的iOS TabBarController

时间:2018-05-23 12:00:28

标签: ios swift uitabbarcontroller

我正在尝试创建一个自定义UITabBarController,而不是显示"更多"查看控制器,我希望我的选项卡可滚动。我已经创建了一个自定义UITabBar,其collectionView带有我的标签,效果很好。

然而,当我添加超过5个选项卡时,更多导航控制器开始发挥作用。我需要它作为我的自定义导航控制器,允许NavigationBar和TabBar在用户滚动时隐藏自己,但是,由于默认的MoreNavigationController是普通的UINavigationController,因此不会发生所需的行为。我已经尝试在我的自定义NavigationController中嵌入我的ViewController,然后再将其添加到TabBarController中,但是(正如预期的那样),因为MoreNavigationController已经在5日之后管理了所有的ViewControllers,它没有任何效果。

我尝试覆盖UITabBarController' var moreNavigationController: UINavigationController并返回我的自定义NavigationController。但是,当我运行我的应用程序时,它会崩溃并显示以下消息:

-[MyApp.ScrollingNavController setMoreViewControllers:]: unrecognized selector sent to instance 0x7ffbce831000 2018-05-23 13:45:27.573611+0300 MyApp[6000:190109] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MyApp.ScrollingNavController setMoreViewControllers:]: unrecognized selector sent to instance 0x7ffbce831000'

我不知道如何克服这个问题,所以如果有任何想法,请告诉我。谢谢!

0 个答案:

没有答案