Split View Controller displayed from a tabbarcontroller - ios

I'm having an xcode project where the the root view is a tab bar controller. The first item of a tab bar is a view controller accessed as a navigation controller's root view controller. The second item of the tab bar is a navigation controller whose root view controller is a splitviewcontroller. When I select the second item, the warning message that I get is
<SplitViewController: 0x7fceea530640> is expected to have a view controller at index 0 before it's used!
The view remains blank. The first tab bar selection works fine. I have attached the project for your perusal. Can someone tell me whats wrong with my code?

In your MainWindow.xib you specify a nib name to load for the DummyViewController but you don't specify anything for the SplitViewController. You've told the tab bar controller what kind of object to use (SplitViewController) but nothing about how it should create child view controllers for that object.
This results in a SplitViewController with no view controllers to use, therefore the error message.

Related

parentViewController and presentingViewController both are nil

I have a tabBarController with 5 tabs the third tab is a navigation controller with TableViewController as the root view controller.
When I press on a row on the table view it push a detail view (regular view controller) about the selected row.
The problem is first time parentViewController and presentingViewcontroller properties (in the details page) are set, all other consecutive both properties are set to nil.
EDIT
I created a single tab application with navigation controller same as the one in the picture but I did not disable auto layout in the storyboard, every time parentViewController is set correctly.
I believe this is a bug if you disabled auto layout.
You are neither creating a child view controller, nor presenting a modal.
(Pushing a detail view controller onto a navigation controller's stack is kind of like adding a child, but navigation controllers predate the parent/child view controller mechanism, so they don't use it.)
What you need to check is the navigationController property of your detail view controller. That should be non-nil if it was pushed onto a navigation controller stack.

Single View Template add navigation

So I started out an app by selecting the single view application template. I have added some more views using storyboard and everything was working good but I now wanted a button to take the user back to the first view using [ self.navigationController popToRootViewControllerAnimated:NO]; but the issue being the template started out as just a viewController. Is there a way to turn the first view into a navigation or root view to make this work or do I have to start all over in a page application template??
Insert a navigation controller in your storyboard before your root view controller.
Set the navigation controller as your initial view controller.
Set the navigation controller's root view controller to what was originally your first view controller.

Issue with tab and navigation view controller

I have an iOS app which is structured in this way:
One tab bar controller with 4 navigation controllers. Each navigation controller has its own view controller with a xib file.
The issue, is that ONLY THE FIRST TIME, when I push a new view into one of the navigation controllers, the new view doesn't appear at all. When I switch to another nav controller (touching one of tab bar's options) and then switch back to the first one, it works all the time.
The error I'm getting is when I come back is:
[35731:70b] Unbalanced calls to begin/end appearance transitions for
.
Thanks for helping out.
Make sure you are presenting all your view controllers from the parent / top level view controller (the tab bar controller). I've had this a few times when presenting a view controller from one of the view controllers in the tab bar.
In viewdidload assign your first view controller to load when xib loads. Its the correct way to load first view controller to appear when nib loads.

Initial View Controller on top level of hierarchy loses NavigationBar

I have a hierarchy of 3 TableViewControllers embeded in Navigation Controller and I need to launch on the most detailed level on the top of the hierarchy. If I change 'Is Initial View Controller' in storyboard to the last detailed TableViewController, my app launches with the selected TVC, but with no NavigationBar. How can I launch on the desired level of hierarchy and keep the Navigation Controller managing the stack of views?
Thank you.
You're telling the storyboard that your third view controller is the root view controller--it has no navigation bar. If you want the navigation controller present as the root view controller then you need to make it the initial view controller, then change the navigation's root to your third view controller.
eg:
initial-->[navigation controller]-->[third VC] [first VC]-->[second VC] (keep these around if you want... just disconnect them from the navigation controller)
You would have to select the ViewController that you want as initial and embed it into a NavigationController, and then add all of the other views after that using push segues.
But why do that? Why not just have the first viewcontroller display the data that you will have in the third view controller? you will end up with the same results.
You should also check out this.

Create a TabBar Controller with a Master-detail template?

I created master-detail template for the ipad application and now I want to add Tab Bar to either master view or detail view. I can easily add tab bar controller using editor->embed in ->tab bar controller. However when I run application tab bar is not showing.
Tab bar is showing in storyboard but I am also unable to add extra tab bar items. What am I doing wrong thanks?
You should embed the navigation controller (of either the master or detail VC) in a tab bar controller, then delete the connection between the split view controller and that navigation controller. Finally, remake the connection from the split view controller to the tab bar controller. You'll also need to make several code changes, because the template code refers to the detail controller by its hierarchy in the split view controller, which will now be different.

Resources