You can hide back button text in many ways.Try this simple approach.
Step1: Goto your mainstoryBoard
and click navigationBar
.
Step 2: Goto Attributes Inspector
under Navigation Item
add a BLANK SPACE in Back Button
Step 3: If you want to change backButton
text method is pretty much the same.
Update 1: If you want to use an image as a back button check this link
Update 2:
Method 2: Using custom image as a back button.
Paste below code into your detailVC
and set image for your back Button.
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
title = "Detail VC"
let customButton = UIBarButtonItem(image: UIImage(named: "back"), style: .plain, target: self, action: #selector(backButtonTapped)) //
self.navigationItem.leftBarButtonItem = customButton
}
func backButtonTapped() {
_ = navigationController?.popToRootViewController(animated: true)
}
I am setting back button image in assets catalogue
with the 32
pixel size.I am not sure about the asset image size.Check with apple doc
about the size class.
Output:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…