Navigation Bar Not Appearing

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:

Newly-presented view controller gets a navigation bar

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



Leave a reply



Submit