TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

How to changing navigation bar back button title in run time?

Forums > SwiftUI

Changing navigation bar (menue) back button title in run time.

1      

Hello there, I'm as of now dealing with changing route bar back button in run time. Anyway it doesn't work. The following is the code where I need to change my back button title. What I maintain that should do is to make my backButton title to be "back", else " ". The strategy for changing back button title appears to work in the initial time when the view loads up, however doesn't change all things considered. Is it to change back Fasten title in run time? supersede func scrollViewDidScroll(_ scrollView: UIScrollView) { let a = tableView.tableHeaderView?.subviews[1]

let heightCheck = tableView.bounds.origin.y + a!.frame.height + navigationController!.navigationBar.frame.height
var backButtonTitle = " "

if heightCheck > a!.frame.origin.y{
  backButtonTitle = "back"
}else{
  backButtonTitle = " "
}

navigationController?.navigationBar.topItem?.backButtonTitle = backButtonTitle

}

1      

Hacking with Swift is sponsored by Superwall.

SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.

Learn More

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.