UINavigationBar without UINavigationControler Swift - ios

I want to add a navigation bar to my view controller (I do not use a navigation controller) to show the page title and contain an add button. However when adding a navigation bar though the interface builder it is not showing. I am assuming it is possible to use it without a navigation controller otherwise there would be little point in allow me to drag it on to a view controller.

Related

do I need to embed navigation controller if I want to make custom navigation bar view?

I need to make a custom navigation bar, since it will have search bar and some other views, it will be easier if I just make custom view instead of inserting view to navigation controller programatically
like the picture below, there are 2 ways to implement custom navigation bar view, by embedding navigation controller (yellow VCs) and use or just using present modally segue (blue VCs)
personally I will choose to use navigation controller because 'maybe' there are some methods that has already built that I can use. but the problem is, the custom navigation view (red color) in navigation controller it seems overlapped by the actual navigation bar in storyboard, I don't know how to hide the navigation bar from navigation controller in storyboard, even though if I use self.navigationController?.setNavigationBarHidden(true, animated: animated), it won't be a problem.
what is the right approach to make custom navigation bar like this?
In IB the navigation bar is shown only to simulate what it might look like when you run the app. The decision to show this is inferred, by default, by the fact that it is downstream from the navigation controller. Luckily you can change this option.

iOS tab bar controller adding a navigation button at the top of the controller

So I have a UITabBarController and it has three buttons on the bottom in my iOS app. I want to add another set of buttons at the top but not quite sure on how to do this. I tried adding a UINavigationBar and a navigation button, and adding a view in to it, adding just the buttons, ect.... but to no avail. It won't let me add anything to the UITabBarController. Is there a way to do this?
Thank you very much.
the simplest way to that is to creat 3 buttons side by side and set their frame the way they divide the top of screen to 3 equals. it means u can create a tab bar with buttons manually.
but there's another way. i think this answer would help u
Positioning UITabBar at the top
To use the navigation bar you need a navigation controller. Now depending on your needs your tab bar controller should be inside a navigation controller or the other way around. If you want to be able to navigate away from the tab bar controller (have a screen without the tab bar) you should embed your tab bar controller into a navigation controller. If you only need the navigation bar for some tabs of the tab bar controller or you still want the tab bar to be visible all the time you should embed all (or just the ones than need a navigation bar) your root view controllers for each tab in navigation controllers. Finally if you do not need the navigation behaviour you could just put a regular view in the view controller that needs the bar at the top and some buttons in it and make them look the way you want.
You can embed a view controller in a navigation controller in a storyboard by selecting the view controller and the going to Edit->Embed in->Navigation controller.
Select the Any Tabbar ViewController then above the Menu -> Editor -> Embed In -> Navigation Controller its select, if you get the Navigation Controller then if you add the Navigation Button at Top of the ViewController, example :

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.

Navigation Bar on Modal View Controller

I have a view controller that executed by a modal view (no Navigation Controller connected). I want to have a Navigation Bar on top and be able to change the buttons and title dynamically depending on what the user has selected on the view controller.
I have read that you can set the View Controllers Simulated Metrics to include either a Translucent or Opaque Navigation Bar.
However, after I select this and add a navigation item to it, I can't get it to show the buttons or title and also don't know how to reference it in code.
Can anyone help walk me through it?
Simulated metrics are a design aid to help in laying out your views; the navigation bar you add that way isn't actually added to your controller at run time. You need to drag out a navigation bar from the object list, and add it to your controller's view.
Simulated Metrics is only to simulate, nothing is changed on your app. If you need a Navigation Bar create it programatically or drag out a navigation bar from the object list.

iOS Navigation Controller doesnt add navigation bar

My situation: http://i.stack.imgur.com/KTlVu.png
I have two views right now. From the second view, I want to have a back button that goes back to the initial view. I added a navigation controller and made it the initial view, and the navigation bar appeared for the first view(PlusCalendar). However, I don't know how to add a navigation bar for the second view(AddEventControllerVC) and add a back button that makes it go back to PlusCalendarView. I have looked at several tutorials and none of them surprisingly dealt with this problem. I am also looking at Apple's class reference and I am not sure if I have to initialize the navigation bar again from the second view controller. My questions are..
How come a navigation bar is not automatically added to all of my views?
For the second view, why does the navigation bar seem to be placed at the bottom?
How do I add a navigation bar on top of the second view, and add a "back" button?
The navigation bar was supposed to add the back button automatically. The problem was that the sigue between my first view and second view was set as a "modal popover." When I changed it to a "push" the back button appeared rightfully.
It seems that in model pop, the navigation bar is not record the view controller in its stack. So it cannot known the back track.In your case ,you should custom your navigation items in the second view controller. You can look this example: custom navigation bar

Resources