mike vorisis mike vorisis - 1 year ago 126
Swift Question

How can I change the text of a UIBarButtonItem in Swift

I have a BarButton and I have a multi language application so I want to change its name programmatically based the language I have selected.

I drag it from the storyboard to my swift file but I didn't see any function which can change its name.
This is my button:

@IBOutlet weak var detailButton: UIBarButtonItem!

Thanks in advance

Answer Source

Simply you can set

detailButton.title = "Back"  //Whatever you want set here
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download