Reputation: 2034
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 "<".
Upvotes: 3
Views: 841
Reputation: 995
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
Upvotes: 2
Reputation: 1321
When you click left bar button
You can set its attribute like:
Here is option to set image.
Upvotes: 0