Home > Blockchain >  Tab bar controller in seconds screen of Navigation bar controller cant see items [iOS Development]
Tab bar controller in seconds screen of Navigation bar controller cant see items [iOS Development]

Time:04-04

(Sorry for bad quality image,Edited my question to make it understandable) Main

I have labelled my screens in the image so its is much better.

Im using navigation controller on Screen A to go to Screen B. But screen B is in a Tab bar Controller as well

(Screen A and Screen B are in a tab bar controller)

When i go to screen B since its in a tab bar controller it should display Bar items in bottom like in the image below. Bar items in bottom

But they dont appear , is it because im navigating from screen a to screen b using navigationcontroller, if so how do i go to screen a to screen b (switching from navigation controller to tab bar controller).

CodePudding user response:

First of all, I think there is a need for better structured question. You may refer to the link below - https://stackoverflow.com/help/how-to-ask

While it may require more time to read and learn how to write a good question, based on my personal experience, I think doing so helps in long term, because we are bound to ask many questions.

It's almost impossible to identify your problem because there is no code snapshot to analyze. But I hypothesise a few possible problems which I also encountered while using tabbar controller.

  1. You might be using navigation controller to move to Screen A to Screen B (self.navigationcontroller.pushViewController...) instead of using tabbar controller itself. You should be using tabBarController?.selectedIndex if you want to "switch" to a different tab.

  2. You might not be "reloading" the items in your screen B when you load screen B, which is not really an issue due to tabbar controller. Try to check the table/collectionview DataSource methods such as cellForRowAt, and make sure you reloadData().

You might wanna check above areas, and also try to edit your questions with some codes.

CodePudding user response:

I don't think you should go from screen A to screen b directly.

Rather from screen A, you should go to your tab bar controller and this tab controller will automatically show screen B within its UINavigationController.

So give your UITabController an identifier in your storyboard first.

Then try changing this:

guard let nextScreen
        = storyboard?.instantiateViewController(withIdentifier: "activitiesScreen") as? ActivitiesViewController

to

guard let nextScreen
        = storyboard?.instantiateViewController(withIdentifier: "TabControllerStoryboardIdentifier") as? UITabBarController

and push this onto your navigation stack.

Give this a try and see if it helps.

  • Related