2

So I manage to change the font of the back button as said in this post but now I have two arrows(<), one is the back button default arrow and the other is the button title arrow ("< Back").

How do I remove/change the back button default arrow to the font want?

Community
  • 1
  • 1
Tharak
  • 23
  • 1
  • 5

1 Answers1

3

One way is to create a transparent graphic and set it as the background image of your Backbutton. So your code should look like this:

    let backButton = UIBarButtonItem(title: "< back", style: UIBarButtonItemStyle.Plain, target: self, action: nil)
    backButton.setTitleTextAttributes([NSFontAttributeName: UIFont(name: "RobotoCondensed-Light", size: 20)!], forState: UIControlState.Normal)
    backButton.setBackButtonBackgroundImage(UIImage(named: "transparent_1px.png"), forState: UIControlState.Normal, barMetrics: UIBarMetrics(rawValue: 0)!)
    navigationItem.backBarButtonItem = backButton
uldo
  • 166
  • 1
  • 5