I\'m trying to add an UIBarbutton with image on my UINavigationbar. However, the button moves to the center instead of keep on the left, also the image becomes huge. Can you guy
Custom Left-bar button image :
let btnBack = UIButton()
btnBack.setImage(#imageLiteral(resourceName: "back"), for: .normal)
btnBack.frame = CGRect.init(x: 0, y: 0, width: 30, height: 30)
btnBack.addTarget(self, action: #selector(addTapped), for: .touchUpInside)
btnBack.imageView?.contentMode = .scaleAspectFit
let leftBack = UIBarButtonItem.init(customView: btnBack)
navigationItem.leftBarButtonItem = leftBack
Also check the size of image which you are trying to set for left-bar button. I used 35 x 35 for 2x image and 53 x 53 size for 3x image.