Search code examples
iosswiftuinavigationcontrolleruitabbarcontroller

tabbar item icon is missing after using navigation controller


my storyboard is like:

enter image description here

I need a back button in Movie Detail View Controller, so I add navigation controller to Archive table View Controller, then when click Archive table View Controller's table cell, it will switch to Movie Detail View Controller with a back button in it.

But Archive image and title is missing after adding navigation controller.

my code in RootTabBarController is like:

func initView() {

    self.addChildViewController(UINavigationController(rootViewController: UIStoryboard(name: "Main", bundle:nil).instantiateViewController(withIdentifier: "archive")))

    self.addChildViewController(UINavigationController(rootViewController: UIStoryboard(name: "Main", bundle:nil).instantiateViewController(withIdentifier: "setting")))

}

How to solve this?

Thanks in advance!


Solution

  • Try one thing. Remove navigation controller and mark your table view controller as initial view controller and then run. if you still can't find your image and text, problem must be in your archive view controller. after removing navigation controller, embed with your archive view controller with navigation controller again and then add with tab bar controller and do rest of the steps.