1

I have a TabBarApplication with four views in the main TabBarItem. The problem comes when I go to any of these views and click in any button to go to another view and when I go back by a button linked to the main view, the TabBarItem of the app disappear!!

For example, one view of the app is a tableView in which each element of the list is linked to his external view and it has a back button that should return to the tableView. All the segues are by modal, not push because push segue crash the application and by modal it runs correctly but the problem comes when I returned by clicking the back button of the NavigationItem in the header of the view to his main view and the TabBarItem of the app is not there, is empty.

Wain
  • 118,658
  • 15
  • 128
  • 151
AvkZ
  • 23
  • 6
  • Solve the crash when using push and use push. Presumably you are never actually going back, just presenting more and more modal views... – Wain Feb 26 '14 at 13:04
  • I don't know why the push segues don't run in a TabBarApp, the error says that Push segues can only be in a UiNavigationController and I don't know how to implement it in the views of a TabBarItem, it doesn't run correctly with it and says always that error – AvkZ Feb 26 '14 at 13:07

1 Answers1

0

Each tab should have the view controller set to a navigation controller, with the view controller you want set as the root view controller of the navigation controller. Now you can use push segues and the standard back button that will be added for you. This will bypass the issue (and work much better for you and users).

You current issue is likely related to not really ever going back. Instead, just always presenting new modal view controllers which replace any existing content on screen.

Wain
  • 118,658
  • 15
  • 128
  • 151
  • I recently try like that and the same error: **Main TabBarItem with his Four views ---(by pushing in any button of the view)-----> UINavigationController -----> The view that I want to link with his back button.** Is that the way that you have told to me? It says the same error about Push segues can't run correctly in TabBarApps – AvkZ Feb 26 '14 at 13:18
  • Can you show a picture of the storyboard when you tried to do this? Do you have code trying to trigger the segue or all linked in storyboard? – Wain Feb 26 '14 at 13:25
  • Here I show you an example of one of the views which link to another view. All of the titles of the main view are buttons which link to the other view. I dont have any code of the segues, all linked in storyboard. http://imgur.com/6nqaEzt – AvkZ Feb 26 '14 at 14:32
  • That picture shows no nav controllers. The nav controller should be between the tab bar controller and the first view controller. Then URL* controllers should be push from the first view controller. – Wain Feb 26 '14 at 15:55
  • I try like that, and the same error: **Push segues can only be used when the source controller is managed by an instance of UINavigationController.** http://imgur.com/Rr5b98b – AvkZ Feb 26 '14 at 16:35
  • The nav controller goes *before* the first view controller! not after. – Wain Feb 26 '14 at 17:45
  • It finally runs. Thank for your help mate! – AvkZ Feb 26 '14 at 18:19