3

I want to have the back button with "< [IMG]" instead of "< Back" which is by default.

let barAppearace = UIBarButtonItem.appearance()
barAppearace.setBackButtonTitlePositionAdjustment(UIOffsetMake(0, -60), for:UIBarMetrics.default)

with this I have removed the text but how to add an image next to the "<".

Parth Adroja
  • 13,198
  • 5
  • 37
  • 71
Nitesh
  • 1,564
  • 2
  • 26
  • 53

2 Answers2

2
let backButton = UIBarButtonItem(image:UIImage(named: "ic_authors_detail_back.png"), style:.Plain, target:self, action:"backButtonPressed");
backButton.tintColor = UIColor(hexString: "#ffffffff")
let leftBarButtonsArray = [backButton]
navigationItem.leftBarButtonItems = leftBarButtonsArray

Here is the code to add a button on navigation bar.Hope this helps

Aman Gupta
  • 985
  • 1
  • 8
  • 18
0

When you click left bar button

enter image description here

You can set its attribute like:

enter image description here

Here is option to set image.

Amanpreet
  • 1,301
  • 3
  • 12
  • 29