Try this:
In ViewDidLoad
let backButton = UIBarButtonItem(title: "< Home", style: UIBarButtonItemStyle.Plain, target: self, action: "goBack")
navigationItem.leftBarButtonItem = backButton
navigationItem.backBarButtonItem?.setTitleTextAttributes([NSFontAttributeName: UIFont(name: "the_font_you_want_to_use", size: size_of_the_font_this_should_be_integer)!], forState: UIControlState.Normal)
and implement the following method:
func goBack() {
self.navigationController?.popToRootViewControllerAnimated(boolean)
}
Just replace the the_font_you_want_to_use, size_of_the_font_this_should_be_integer and boolean with the values you want, and everything will be working.
*** EDIT
If you don't want to get back to Root View Controller
, instead of
self.navigationController?.popToRootViewControllerAnimated(boolean)
you can say:
self.navigationController?.popViewControllerAnimated(boolean)
or even pop to some other ViewController
with specifying the first parameter of the popToViewController
to be the object of YourViewController
class, and second the boolean value for animation.