Show Navigation Bar in Swift - uitableview

I'm creating an App in swift. My first viewController (Login) shows perfectly with the action bar. But in others view controller i can't see the navigation bar. I was trying to embed all over controller in the navigationController,but it does not work. For example,i have other view controller with the name showlistas that have a search bar, when it loads, i see only the search bar, the navigation bar does;t appear. How can i solve it please?

Try making all the segues 'push' segues, it seems to make a difference to me.

Related

Using UITabBarController with UINavigationController - Swift 3

I am making an app which requires a use of a UITabBarController along with UINavigationController. I have made the following flow in storyboard.
See image
Now the first question is that is this accepted by Apple, as there are too many discussions for the same.
The other matter of concern is that is it possible to eliminate any UINavigationController and still get the same flow of the app? The main thing required is to have the SAME tab bar and navigation bar on all sub tabs of the tabs. One point to be noted is that if I remove the second UINavigationController then my app navigates directly from sub tab to home view controller on clicking back button.
I have been stuck on this since hours now. I am new to iOS app development and have never uploaded any app to the app store. Any help would greatly valued.
EDIT :
I put the second navigation controller as shown in the answers - see this flow, But because I have a navigation controller before the HomeViewController, so I am getting a navigation bar at the top and then some empty space below that(exactly equal to the top navigation bar) and then the page contents on runtime. Any solution to this?
Yes, it is acceptable by Apple.
But View hierarchy is not managed correctly. In your case Tab bar will be the root view controller for 2nd navigation controller.
Also, Tab and sub tab you are pushing will be part of 2nd navigation controller.
That's the reason you are getting back on Home view controller.
It's good practice to keep navigation controller to each Tab to manage it's sub-tab hierarchy.
You could present tab bar controller or setviewcontroller from Home View controller.
First embed tab bar controller as in this image and the embed navigation bar controller as in this image finally this will look like

Do I need to implement a Navigation Controller to make a UISearchViewController?

I'm working on my first iOS app and I'm realizing just right now that I don't have a navigation controller. Since I'm already pretty far in the app and not completely sure of how I would implement a navigation controller, I was wondering if I would need one in order to implement a search controller, meaning a UITableViewController with like a navigation bar on top.
To implement a Navigation Controller you just need to select the View Controller in storyboard then Click up top Editor -> Embed In -> Navigation Controller. You could also just add a navigation bar to the top of the View Controller you are using.
These are the two options for adding a navigation bar, however, neither is required for adding a search bar.
You do not need to add a navigation controller just to display a navigation bar. Navigation bar can be added to any UIViewController.
You can also add just the search controller in a navigation controller, without affecting your other view controllers. This will add a Navigation bar to the search controller and also allow you to navigate to (Push) other view controllers.

Weird nav controller behavior with different tab bar stacks

I have a tab bar controller with a nav bar embedded in each tab as root. I am using a detail view controller that will be accessed from 2 of these tab bar stacks. When accessing this view controller in it's own stack, everything works as expected. However, if the user is in the other tab and segues to this detail view controller, the view slips behind the navigation bar. Its like the nav bar isn't even there, it just goes underneath it. I've been scratching my head trying to figure out what's going on, any insights would be greatly appreciated!
Figured it out for those in a similar predicament. Need to add navigationController?.navigationBar.translucent = false in viewDidLoad. In iOS 7 this changed, by adding this line it won't slide the view beneath the nav bar.

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.

Using UITableViewController in a navigation bar

I'm new to iOS, but I know the basis. I want to host 3 UITableViewController in a UITabBarController using the storyboard.
I dragged a UITableViewController from the object list(?) and control dragged creating a seguel. Now the tab shows successfully the table view controller.
The issue is the rows are taking the space of the status bar. So I want a navigation bar(?) there, with a title. Since I'm new to iOS I don't know the following:
Given the fact that UITabBarController is the first controller ever, the hosted UITableViewController should not have a back button, obviously. So is it correct to use a navigation bar to display a title (and possible add/edit buttons)
If so, I tried dragging the Navigation Bar but it doesn't work.
What am I missing or doing wrong?
hope this helps
actually it is done for another answer. but it will be handy to u too
You will want to add in 3 UINavigationControllers. Have each tab in the tab bar controller segue to a different navigation controller. Then set the root view controller for each navigation controller to one of the table view controllers.

Resources