uitableviewcontroller not showing top bar after segueing programmatically from the root controller of a navigation controller - ios

after trying many things and searching for all the related questions and not being able to fix the issue.
this is the current situation in the storyboard:
the top bar of the home tableviewcontroller does not show up even though in the login and signup view controllers it does.
the segues from those view controllers are triggered programatically in the actions triggered by button clicks.
even when setting the top bar to be opaque/translucent and not inferred it still wouldn't show up.
---- update -----
tried adding navigation controller:
added navigation controller
it doesn't even perform the segue now...
because the initialisation in the prepare for segue is preparing a different
destination view controller.
tried to make a custom navigation controller class but that made problems as well.
please help!

Related

Why is the tab bar disappearing?

My current setup of viewcontrollers are:
tab view > navigation controller > table view controller > navigation view controller > cell details. Please see
The current setup of viewcontrollers
I used to have:
tab view > navigation controller > table view controller > cell details
and then everything was fine.
The issue is that I need a custom action to happen when the user presses the back button, and to do this i added a nav controller between the "table view" and the "cell details". And thats when the tab bar disappeared. I understand this seems to be "normal" behaviour, but that donĀ“t help me much. Please help.
The code that segues to the detail view controller. (I use the storyboard, so light on code for these things)
#IBAction func add(sender: AnyObject) {
dispatch_async(dispatch_get_main_queue()) {
self.performSegueWithIdentifier("TableViewToDetailView", sender: self)
}
It happens when hideTabBarOnPush property is true(in code) or Hide Bottom Bar on Push is checked on storyboard for the controller you are pushing.
I had a similar problem and the right question was kind of hard to ask. using Tsb Bar Controllers with Navigation Controllers and View Controllers os too tricky and certain things a re not allowed and there is a lot of terminology, and, there are many different types of segues,and there are many different kinds of consequences for doing certain things.
I found the correct procedure (answer) in the second part of this two part series:
Storyboards Tutorial for iOS: Part 1
Storyboards Tutorial for iOS: Part 2
Summary of the procedure:
Embed the source and destination View Controllers in Navigation Controllers, then create unwind segues (methods with the signature#IBAction func methodname(_ segue:)) in the source view controller. Then, from the destination View Controller, control-click from the navigation bar button (or any view required to trigger a return to the first view controller) to the Exit object above the view controller then pick the correct action name from the popup menu. The unwind segue will be accessible from the Document Outline and can be given an identifier to use in prepare(for:sender:) in case data needs to be sent to the from the destination view controller. Also, the segue from the first view Controller to the second navigation controller must be modal.
A similar issue I met although maybe not quite the same as yours but hope it may help. When view controller A presents view controller B, the hidesBottomBarWhenPushed property of B could be overridden by the hidesBottomBarWhenPushed property of A. I fixed it by setting B's modal style.

Can't add navigation bar to scene: Root view controller issue?

I'm still struggling with navigation bars and just can't work out how to edit or verify that I have a navigation bar on my view and I would appreciate any help.
I have a project with another set of scenes similarly comprising of a navigation controller and three associated view controllers (connected via segues and main table view embedded in the navigation controller) and I was able to add a navigation bar manually in interface builder to the outer view controllers that were segued to the table view controller.
But in this set of scenes the navigation controller is set up as the root view controller for the table view.
I have another set of scenes. A navigation controller and two related view controllers - both table view controllers. I embedded the first table view controller in the navigation controller and I then added a second table view controller to this (for a new screen I want to add to my app) and I connected this second table view controller to my first table view controller by way of a show segue (just like I did yesterday with other set of scenes).
Can I set this other navigation controller as the root controller also?
Like, can I have two root view controllers in a project?
It looks to me like there is a navigation bar visible (see screenshot below) on my new table view controller but I can't click in to it to edit it to add a title to it.
But does a navigation bar and exist, and if so, why can't I click inside it and use it?
I was told in an answer to a previous question that you have to add a navigation bar manually to your storyboard scene to any additional view controllers. I did that yday and it worked. But today when I tried to add a navigation bar by dragging onto scene it wouldn't let me do this.
Here is the screenshot:
Try adding push segue(which is depreciated) and than change it to a show segue(between your tableviews). This is a workaround I use in my apps.
Ran into the same problem. Had a good fallback position, I am doing a tutorial that came with example programs completed and working so the first thing I did was see if it was a version glitch between 6.3.2 and 6.4. Turned out the earlier project worked just fine.
So what I did was simply drag the 'Item' in the sidebar and moved it under the Root View Controller!
I've experienced the same issue.
However, by saving and closing the project then reopening it, the Navigation Bar title is then able to be edited. Prior to closing/reopening the project the field could not be edited.

Tab bar controller is not showing bar button item

I'm new in Objective-C, and even more using storyboards. This being said I'm trying to use a bar button item within UITabBarController and UINavigationController as can you see in the image below.
But once I run the project in simulator this item is not showing. I would appreciate a non programmatically solution if it's posible.
Okay, so the way to do this:
When you create your tab view controller. You have to add a navigation controller that will handle each tab.
Tab View Controller --> navigation controller --> View Controller 1.
Then add the bar button item to view controller 1. Then go ahead and add the segues.
Now, still it won't show up.
But, if you go to your code for your view controller 1: Add a reference from the storyboard of your bar button item into your View Controller 1 file. Then, in ViewWillAppear():
self.tabBarController.navigationItem.rightBarButtonItem = _btnNewContact;
From there, it will show up and the segue you have configured in your storyboard should work perfectly! =)
After I spent a while trying to get the best way to do it I finally did that I should have done since begin. Read official apple documentation.
Parameters
viewController
The view controller that is pushed onto the stack. This object cannot be an instance of tab bar controller and it must not already be on the stack.
In other words, my approach is just a bad design.

Modally Presenting a Navigation View Controller in a UITabBarController With a Segmented Control

I've spent the past few days searching on the web for a solution to my problem, however, I can't seem to find a problem similar to mine. I am using a TabBarController and on one of the tabs I have a segmented Control in the navigation bar that I would like to use to switch between view controllers. The problem is that when I present the second view Controller it appears over the tabbarcontroller. Is there anyway to keep the modally presented Navigation controller in the tabbarcontroller?
This is the first controller.
And this is the controller I am trying to present.
well we can't really comment unless we saw some code. But I think your problem may be to do with your view hierarchy. If I was going to build what you are attempting I would do as follows:
UITabbar controller that contains a custom navigation bar controller
The custom nav bar controller would contain the segment controller and have a protocol defined so that a delegate could be alerted when either segment was selected by the user.
The nav bar's root view controller would be a view controller that acted as a UIView container for the two screens you are displaying (friends and circle screens)
This root view controller would be the delegate for the custom nav controller so that it will know when the user selected a segment.
When the user selected a segment the root view controller would then switch between the friends and circles view controllers in the container.
To do the above have a look at the documentation for creating UIViewController Containers and working with delegates
Hope that helps!

iOS - NavigationBar Title overlapped by previous viewController

we have the issue, that if we pop back from a VC, the current ViewController's navigationBar title is overlapped by the just popped VC navBar title.
But it occurs only sometimes, so i assume it's maybe just a UI refresh bug. Did someone have this problem before, if yes.., how to fix it?
regards ..
I've run into this a few times in the app I maintain. In every case the problem was caused by people doing silly things with navigation controllers.
For example, when wishing to navigate to a new view, a view controller that was already part of a navigation controller's view stack would instantiate a new navigation controller and push its root view controller onto the first navigation controller's view stack.
Then, in the new view controller (the one contained in the second nav controller's view stack), they would try to pop to a previous view. This would cause funny animation bugs and random titles to show on the navigation bar.
The solution was to remove the second navigation controller from the flow (it didn't serve any particular purpose).

Resources