skip to Main Content

I tried to identify what the "Back" text is from by the following:

  public override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    self.navigationController?.navigationBar.setTransparent(style: .default)
    print(self.navigationItem.backButtonTitle)
    print(self.navigationItem.backBarButtonItem?.title)
    print(self.navigationItem.title)
    print(self.navigationItem.titleView?.largeContentTitle)
  }

However I got all nil outputs, which means these titles are not there:

nil
nil
nil
nil

I also tried this:

self.navigationItem.setHidesBackButton(true, animated: false)

It works but it hides the whole thing, including the back arrow "<" and the text "Back". I wanted to keep the arrow but only remove the text.

Where can I find this title or text that says "Back" and set it to empty string?

enter image description here

3

Answers


  1. one way is shown in attached Image.

    Second one is follow:

    navigationItem.backButtonTitle = ""
    

    enter image description here

    Login or Signup to reply.
  2. This will work for you

    self.navigationController?.navigationBar.topItem?.title = " "
    
    Login or Signup to reply.
  3. You can use custom left bar button item, in viewDidLoad:

    let myimage = UIImage(systemName: "chevron.backward")
        navigationItem.leftBarButtonItem = UIBarButtonItem(image: myimage, style: .plain, target: self, action: #selector(handleBack))
    

    to go back the button call handleBack func:

    @objc fileprivate func handleBack() {
        navigationController?.popViewController(animated: true)
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search