Navigation bar not appearing?
You're presenting your ViewController like this:
let vc = storyboard!.instantiateViewControllerWithIdentifier("TutorSignUp") as! SignUpViewController
self.presentViewController(vc, animated: true, completion: nil)
so your SignUpViewController
doesn't actually have a UINavigationController
as a parent.
This will fix that:
let vc = storyboard!.instantiateViewControllerWithIdentifier("TutorSignUp") as! SignUpViewController
let navigationController = UINavigationController(rootViewController: vc)
self.presentViewController(navigationController, animated: true, completion: nil)
Navigation Bar, not displaying on second ViewController
Each modally-presented view controller gets a brand-new view hierarchy. This means that if you want your MakeTaskViewController
to have a navigation bar, you'll need to manually add a navigation controller.
class ViewController: UIViewController {
// ... your code ...
@objc func didTapPlus() {
let vc = storyboard?.instantiateViewController(identifier: "makeTask") as! MakeTaskViewController
vc.modalPresentationStyle = .fullScreen
vc.title = "Create a Task"
vc.view.backgroundColor = .black
vc.navigationItem.leftBarButtonItem = UIBarButtonItem(
title: "Back",
style: .done,
target: vc, /// make sure to set `target` as the new view controller
action: #selector(vc.dismissMe))
/// wrap the new view controller in a navigation controller (this adds the top bar)
let navigationController = UINavigationController(rootViewController: vc)
/// so you can actually see the `Create a Task` text,
navigationController.navigationBar.barStyle = .black
present(navigationController, animated: true)
}
}
/// side note: `MakeTaskViewController` and other classes should be Capitalized
class MakeTaskViewController: UIViewController {
@objc func dismissMe() {
self.dismiss(animated: true)
}
}
Result:
Navigation bar back button is not showing?
- First:
You should make the source view controller (not destination) as rootViewController of the navigation view controller. You probably set the segue as push instead of that.
- Second:
Make sure you don't set the back button item manually anywhere.
Navigation Bar and navigation items not visible on runtime
There is no back button because there is nowhere to go back to. Your sign up and sign in view controllers are the root view controllers of their respective navigation controllers.
There is no visible title because what you are looking at is the navigation item of the tab bar controller, which has no title.
Your architecture posits a navigation controller insider a navigation controller, which is illegal:
nav controller -> tab bar controller -> nav controller
You can't do that.
Also you can't put a tab bar controller inside a navigation controller. A navigation interface inside a tabbed interface is fine (as illustrate in Apple's own docs: https://developer.apple.com/documentation/uikit/uinavigationcontroller). The reverse, a tabbed interface inside a navigation interface, is not.
The simplest solution is to eliminate the first navigation controller completely, as there is no need for it (you are not pushing anything onto it beyond its root view controller).
Swift 3 - Why is my Navigation Bar not showing?
You are showing vcString is your LoginVC
,
you need to use NavigationController identifier like loginView
or
You need to embded in NavigationControler
before show
let initialVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: vcString)
let navi = UINavigationController.init(rootViewController: initialVC)
and
window?.rootViewController = navi
why is my text not showing after the navigation bar?
Basically issue you are facing caused by having position:fixed
on <nav>
tag, this attribute will make the browser to remove the nav from the rendering flow and treat it as if its not there, so to make you content after it appear, all you can do is to push all elements down using padding:70px
or so, working snippet:
body{ margin:0; padding-top: 70px;}
nav{ position: fixed; top:0; width:100%; background-color:#f2bbac ; float: right; height:70px; font-family: 'Quicksand', sans-serif;}nav ul{ list-style: none; padding:0; margin:0;}nav a{ text-decoration: none; font-size: 20px; color: white; text-transform: uppercase;}nav a:hover{ color:gray;}nav li{ display: inline-block; margin-left: 40px; padding: 20px;}
<!DOCTYPE html><html lang="en-us"><head> <link href ="stylesheets/mainstyle.css"rel="StyleSheet" type="text/css"> <title>books</title> <link href="https://fonts.googleapis.com/css2?family=Quicksand&display=swap" rel="stylesheet"></head><body>
<nav> <ul> <li><a href="mainpage.html">Home</a></li> <li><a href="aboutpage.html">About</a></li> <li><a href="contact.html">Contact Us</a></li> </ul> </nav> <h1>hello there. testing</h1></body><script src="script.js" async defer></script></html>
Navigation Bar Title Not Showing
Try to set the view controller's title property to "Hello"
self.title = "Hello"
If it works, you can find an explanation in AWebster's answer here Swift - Title Not Appearing for Navigation View Controller
Related Topics
Passing Data Between View Controllers Without Segue
Gmsmarker Icon in the Top Left Corner of the View (Ios)
Compiler Error When Assigning the Delegate for a Protocol in Swift iOS
Masked Uivisualeffectview Does Not Work on iOS 10
iOS Swift Connect Wifi Programmatically and Distinguish Between Bad Password and No Wifi in Range
How to Eliminate the Margin on the Left Side of a Uitableview, Without Creating a Gap on the Right
3D Touch Quick Actions Not Working at All
Include Pods in Main Target and Not in Watchkit Extension
Recognizing Touch Events Only Inside the Masked View
Swift - Uipopovercontroller in iOS 8
Differrence Between Closure and Function as Argument in Swift
Restkit, Coredata and Swift - I Can't Seem to Fetch Results Back Out
Saving Contact Address to Unified Contact Results in (Cnerrordomain Error 500)
Transition Delegate for Uitabbarcontroller Animation
Core Data Transient Values with Swift
How to Programmatically Check and Open an Existing App in iOS 8