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.
Related
I have a tab bar controller with 3 tabs, each embedded within its own navigation controller. This works great, but now I’m trying to put the entire tab bar controller within a split view controller.
The problem is the navigation on the master view for the split view controllers hides the existing navigation for the views inside the tab bar controller. If I hide the master view navigation, I get my tab bar controller navigation back but then I have no way of getting back to the master list. I can add the button back in programmatically but it only works on the iPad.
navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem()
navigationItem.leftItemsSupplementBackButton = true
I also tried playing around with the various options for preferredDisplayMode, but again, this only works on the iPad. It has no effect on the iPhone. I can add in a custom button programmatically to the view controller within the tab view controller and call an action from there, but I don't know what action to call. I tried calling the action on the displayModeButtonItem:
splitViewController?.displayModeButtonItem().action
That didn't work either. I would like to be able to just programmatically add back in the behavior of the back button that the split view controller adds on the iPhone.
I ended up scrapping the split view controller and just using anther tab. However I had a similar problem in another app and I figured out a kind of hacky solution. I embedded the tab bar controller itself inside a navigation controller. This causes multiple navigation controllers to appear so I did a check in viewWillAppear to hide whichever navigation controller is causing the issue.
if let hidden = tabBarController?.navigationController?.navigationBarHidden {
if hidden == true {
tabBarController?.navigationController?.navigationBarHidden = false
}
}
This app has a split view controller as the root view controller and then tab bar controllers in both the master and detail views. Every view is embedded in a navigation controller and I just show or hide the navigation bar depending on if I have a duplicate.
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.
I have UITabBarController based app. To simplify, let's assume I have one Tab Bar Item pointing to Navigation Controller that holds Table View Controller.
In addition I have a separate Scroll View Controller.
What I'm trying to solve is how can I have Scroll View Controller loaded after app launch and Tab Bar visible at one time. It means that Scroll View shouldn't be one of the tabs.
I'm puzzled how to achieve it. Appreciated for any help.
I searched about this case but I couldn't find how to embed tab bar controller inside a navigation controller properly.
To be more specific; I created navigation controller in didFinishLauncinhWithOptions method inside the appdelagete and I am navigating through my view controllers without any problem.
I have a mainViewController with has 3 button and every button is pushing anotherView to navigation controller. In one of the views I am redirected, I want to use a tabbar.
My question is where should I create my tabbar controller in this case and is it allowed to embed tabbar controller inside navigation controller ? If not what should I do because, I really wanna embed my navigation controller from start and have navigation bar thorough out the entire program.
Thanks in Advance.
After struggling some times, I managed to figured out the solution by inserting new view below the tabbar.
This thread really helped me much about the case;
Tab bar controller inside a navigation controller, or sharing a navigation root view
Cheers;
I am confused with behavior, I have Tab Bar Controller ( I enter on this controller from simple view controller which is embedded in navigation controller). I am confused why is that navigation bar from tab is covered up child navigation bar.
When I start app and I enter at Browse Controller I cannot see Browse title, neither nav bar items which I added programmatically. Can somebody give me clue what is wrong ( I am new to this, I connect with push segue from tab to browse).
Your problem appears to be the same as the one I addressed here:
Push segue from a view controller controlled by UITabBarController
What's happening is that your first NavigationController is creating a Navigation stack. Then you push-segue a TabViewController. That is added to the Nav stack, along with each of it's contained view controllers. However, when you PUSH SEGUE from one of those view controllers to some other view controller, the original navigation controller's stack is the one you are pushing on to. This is not contained inside the tab view controller, so the pushed view controller has no relationship with that tab view controller, just the original navigation controller stack. Therefore the tabs are not present.
The answer is to embed each of the tab controller's view controllers in a new navigation controller, and push on from those. The original navigation controller is just messing things up here...