swift - Setting the text of a BarButtonItem on the NavigationBar? -


id remove icon , add text barbuttomitem, im not sure how it. here currrent code:

let logoutbutton = uibarbuttonitem(barbuttonsystemitem: .action, target: self, action: #selector(settingsviewcontroller.logout))         self.navigationitem.setrightbarbuttonitem(logoutbutton, animated: false)   

i thought uibarbuttonitem(text: "sign out", ... guess doesn't work.

you can connect uibarbuttonitem ui.

enter image description here

@iboutlet weak var logoutbutton: uibarbuttonitem!  

it should when connect it.

setting of button can this

enter image description here

and put line viewdidload func:

   //logout button     logoutbutton.title = "sign out" //this button title 

:) should work.


Comments