Creating an initial view before displaying views with UITabController - ios

I am creating an app that uses a UITabController with 5 tabs for navigation. Right now my app loads the first tab as the initial view upon app loading.
I want to be able to change that so I have a view that doesn't use my UITabController as the initial view, and once they click the one button on it, it brings them to the First View and displays the TabController.
I thought I'd simply set up a new view, change that one to the initial view controller and have a segue from the button to the TabController, but when I tried that and the view I wanted to with the button loaded first, but when clicking button it said something about needing to set up a NavigationController? Not sure what to do from here.

I think it's best to leave your tab bar controller as the window's root view controller. You can present the initial view controller from the viewDidAppear method of the controller in the first tab, using presentViewController:animated:completion:. Do this with the animated parameter set to NO, and the initial view will be the first thing the user sees. When you're done with that view, just dismiss it, and you'll be back to the first tab's view.

Related

How do I jump to say, the second view controller in my navigation controller at app launch?

Like many apps, I have a main screen in my app that I want the app to launch to, but they also have the option of going back a screen to somewhat of a "home" view. I don't want to present this modally, as it is technically "before" the view controller they launch at.
So if my navigation controller has this first "home" view controller, then the "main" view controller after that (then some others after that...) how do I start the app at the second, main view controller and still allow them to easily press back to go home?
I tried setting my "Initial view controller" in my Storyboard to the second one, but it doesn't seem to work as it doesn't show the navigation bar and seemingly won't allow you to go back.
I'd recommend setting the "home" view controller as the "Initial view controller", but then segueing to the "main" view controller in the viewDidLoad or viewWillAppear of your "home" view controller; that way, unlike in Mike's answer, you can dismiss that "main" view and go back to the "home" view before it such that it's the only view controller on the stack.
You should make the second viewController the initial view, then make a UIBarButton on the second viewController, to let the user go back.

The TabBarItem disappear when I push in other view

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.
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.

displaying UIPickerView over current ViewController xcode

Here is my current problem. I have a UIViewController setup with its data and everything on a small sized view controller. What I am trying to see is if it is possible to connect that to a separate view controller. For example I have a view controller that has a user click a button. Upon pressing the button the UIPicker ViewController would pop up from the bottom and I could go from there. I know how to enable this if the picker is on the same view controller. However, I have no idea how to if its on its own ViewController. Any ideas?
One way to do this would be to put the picker view on the same view controller and make it hidden, and, when they press the button, unhide it or load the other view controller when they press the button; this will display the other view controller, not what's on the current one.

Tab bar disappears when trying to go back from new view

I am very new to Xcode and have encountered an issue with my app. I am trying to create a tab bar app. On one of the tabs I have a button that brings the user to a different ViewController. I want to have it so the user can select a button that would return them to the tab that had the button. I tried to set up an action from the button to the previous view (the tabbed screen), however the tab bar disappears. I hope this is makes sense.
Here is a link to a screenshot...
Easiest way to do this is to place a UINavigationController as the root view controller of the TabBarController. You can do this in storyboard by simply ctrl+dragging from the tabbar controller to the navigation controller and adding it as a relationship.
Here's an example using storyboards:
The next step is to set the third controller (in this case the table view controller) to your player view controller class.
Then, you can use the default back button and animation that comes with the navigation controller. If you prefer to hide the navigation bar at the top of the screen, then you can use your custom back button to call
[self.navigationController popViewControllerAnimated:YES];
You can also choose custom animations / segues, etc. but using a navigation controller to help you navigate screens is probably the simplest approach.

Maintaining popover across multiple detailviews in UISplitView

In my app delegate I create a UISplitViewController. I set the delegate to be the detailViewController.
When I run my app in portrait, I have the left top popover button showing that will slide out the split view master.
Then I have a button in my detail view that resets the splitviewcontroller array with a new detail view controller and sets the split view delegate to that controller.
The second detail view displays properly... but I lose my popover button on the second view controller.
Does anyone know how I can get that button to remain on all of my detail view controllers I may add?
Thanks!
See http://www.raywenderlich.com/forums/viewtopic.php?f=2&t=1546 for what I find to be a good approach.
It involves setting the SplitViewController delegate to be the master instead of the detail. The master keeps references to the popoverController and the button, and each time the delegate methods are called (hide and show master) it gets the current detail view and performs the necessary action (add in the button/remove button and popovercontroller).
The master defines a protocol for "SubstituableDetailView" which contains the two methods for showing/hiding the button.

Resources